[OpenBazaar API Ruby Client](https://github.com/inertia186/obarc) ========================== A simple OpenBazaar API client for Ruby. #### Fixes in 0.5.2 * Support for gem release. * Dependency refresh. * Deprecation removal. ### Installation Add the gem to your Gemfile: ```ruby gem 'obarc' ``` Then: ```bash $ bundle install ``` ### Usage ```ruby require 'obarc' session = OBarc::Session.new(username: 'username', password: 'password') profile = session.profile ``` ```json {"profile": {"website": "website", "public_key": "b7d8f6ee04453e1babde87d12198ecd14be00aa998e85636767d8b00d2603e6d", . . . "primary_color": 16777215, "background_color": 12832757, "email": "email@bogus.com"}} ``` ```ruby session.update_profile(email: 'big@vendor.com') ``` ```json {"success": true} ``` ```ruby session.connected_peers ``` ```json {"peers": [["5.37.3.8", 28467]], "num_peers": 1} ``` If you want to manually upload an image, this will return the image hash. ```ruby session.upload_image(image: 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAC91JREFUWAktl3mQHOV5xn99zH3u7K1d7Uq7CEkIpNVZRhagQDjKCcaxSIJNIJTjI5XCuakKceXyHy5XnJSr') ``` ```json {"image_hashes": ["a89810619833ef29d373c124ce05f362a313929e"], "success": true} ``` You can also add a new listing with image URLs in the hash. The client will upload them and save the image hashes to the contract. ```ruby session.create_contract( expiration_date: '', metadata_category: 'physical good', title: 'Black Dress', description: 'A pretty black dress.', currency_code: 'USD', price: '19.95', process_time: '3 Business Days', nsfw: 'false', shipping_origin: 'UNITED_STATES', ships_to: 'UNITED_STATES', est_delivery_domestic: '5-7 Business Days', est_delivery_international: '', terms_conditions: "We cannot ship to PO Boxes/APO's\n * We cannot combine shipping.\n * No Local Pickup.", returns: "Your satisfaction is guaranteed! If for any reason you are unhappy with your item, we can arrange a return within 14 days for a full refund, minus shipping cost. Please contact us prior to initiating a return so that we can issue you a refund authorization.", shipping_currency_code: 'USD', shipping_domestic: true, shipping_international: false, keywords: 'dress', category: '', condition: 'New', sku: '123456789', image_urls: ['http://i.imgur.com/2KXXHSt.jpg'], free_shipping: true ) ``` ```json {"success": true} ``` ## Tests * Clone the client repository into a directory of your choice: * `git clone https://github.com/inertia186/obarc.git` * Navigate into the new folder * `cd obarc` * Basic tests can be invoked as follows: * `rake` * To run tests with parallelization and local code coverage: * `HELL_ENABLED=true rake` * To run tests against a testnet server: * `TEST_NET=true OB_SERVER_HOST=localhost OB_USERNAME=username OB_PASSWORD=password rake` ## Docmentation * [Session](http://www.rubydoc.info/github/inertia186/obarc/master/OBarc/Session) - Most of what you need in your app is explained here. ## Requirements * `ruby 2.1.5` * `bundler 1.11` * `OpenBazaar-Server 1.1.15` ## Get in touch! If you're using OBarc, I'd love to hear from you. Drop me a line and tell me what you think! <center> <img src="https://cl.ly/233t0q0v2j0p/obarc-logo.png" /> </center> ## Licence I don't believe in intellectual "property". If you do, consider OBarc as licensed under a Creative Commons [![CC0](http://i.creativecommons.org/p/zero/1.0/80x15.png)] (http://creativecommons.org/publicdomain/zero/1.0/) License.
post_id | 2,335,326 |
---|---|
author | inertia |
permlink | obarc-v0-5-2-openbazaar-ruby-api-client |
category | openbazaar |
json_metadata | "{"app": "steemit/0.1", "format": "markdown", "links": ["https://github.com/inertia186/obarc", "http://www.rubydoc.info/github/inertia186/obarc/master/OBarc/Session", "http://creativecommons.org/publicdomain/zero/1.0/"], "image": ["https://cl.ly/233t0q0v2j0p/obarc-logo.png"], "tags": ["openbazaar", "bitcoin", "blockchain", "life", "cryptocurrency"]}" |
created | 2017-04-05 00:39:18 |
last_update | 2017-04-05 00:50:36 |
depth | 0 |
children | 5 |
net_rshares | 17,638,198,149,332 |
last_payout | 2017-04-12 00:39:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 3.386 SBD |
curator_payout_value | 0.454 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 4,088 |
author_reputation | 227,335,189,892,062 |
root_title | "OBarc v0.5.2 - OpenBazaar Ruby API Client #openbazzar" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 0 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
berniesanders | 0 | 915,521,814,800 | 5% | ||
pharesim | 0 | 577,749,096,619 | 6% | ||
rossco99 | 0 | 607,845,478,050 | 51% | ||
boatymcboatface | 0 | 296,687,855,119 | 51% | ||
kingscrown | 0 | 118,693,394,632 | 51% | ||
teamsteem | 0 | 339,282,688,690 | 100% | ||
cryptoctopus | 0 | 1,595,503,189,491 | 100% | ||
lola-carola | 0 | 1,551,554,978 | 100% | ||
dragonslayer109 | 0 | 442,595,467,283 | 100% | ||
theshell | 0 | 47,313,387,678 | 51% | ||
applecrisp | 0 | 53,292,082 | 20% | ||
arisa | 0 | 3,011,537,727 | 100% | ||
raphaelom | 0 | 567,768,672 | 100% | ||
christoryan | 0 | 14,386,967,454 | 100% | ||
seth-krings | 0 | 150,688,050 | 100% | ||
crok | 0 | 6,296,882,311 | 100% | ||
christoph3 | 0 | 4,858,126,553 | 100% | ||
fyrstikken | 0 | 53,078,652,994 | 2.5% | ||
michaellamden68 | 0 | 2,439,432,437 | 100% | ||
asmolokalo | 0 | 246,649,032,788 | 100% | ||
joshbreslauer | 0 | 291,818,537,560 | 80% | ||
robrigo | 0 | 574,789,580,042 | 100% | ||
slowwalker | 0 | 1,796,271,746,197 | 51% | ||
vi1son | 0 | 36,443,353,046 | 100% | ||
ausbitbank | 0 | 156,228,641,347 | 100% | ||
pet1000 | 0 | 232,276,009 | 100% | ||
speda | 0 | 145,508,113,940 | 100% | ||
inertia | 0 | 272,165,761,294 | 100% | ||
coininstant | 0 | 32,362,116,038 | 100% | ||
ubg | 0 | 702,982,707,663 | 100% | ||
deanliu | 0 | 76,646,452,926 | 100% | ||
celsius100 | 0 | 45,737,226,915 | 100% | ||
seb | 0 | 320,845,588 | 100% | ||
raymonjohnstone | 0 | 11,506,931,833 | 100% | ||
sergey44 | 0 | 571,932,227 | 100% | ||
michaeldodridge | 0 | 309,269,756,536 | 100% | ||
dirty.hera | 0 | 952,342,233 | 100% | ||
french.fyde | 0 | 6,996,675,282 | 100% | ||
transhuman | 0 | 4,205,620,847 | 44% | ||
laoyao | 0 | 32,979,786,435 | 100% | ||
kurtbeil | 0 | 108,660,759,190 | 100% | ||
fishingvideos | 0 | 23,115,015,124 | 100% | ||
oflyhigh | 0 | 34,569,904,632 | 100% | ||
lordvader | 0 | 132,798,205,613 | 100% | ||
ioc | 0 | 896,953,917,384 | 100% | ||
chinadaily | 0 | 48,105,974,465 | 100% | ||
helene | 0 | 47,824,313,812 | 100% | ||
lamech-m | 0 | 4,889,277,976 | 100% | ||
jyp | 0 | 192,802,883,324 | 100% | ||
sethlinson | 0 | 4,338,226,379 | 16% | ||
hilarski | 0 | 58,443,502,196 | 20% | ||
dajohns1420 | 0 | 4,555,787,153 | 100% | ||
runridefly | 0 | 6,472,829,363 | 10% | ||
contentjunkie | 0 | 56,307,056,344 | 100% | ||
macksby | 0 | 80,287,550,736 | 100% | ||
azz | 0 | 84,902,481 | 100% | ||
team101 | 0 | 420,117,164 | 100% | ||
jag | 0 | 81,911,197 | 100% | ||
reaction | 0 | 1,604,502,567 | 100% | ||
titusfrost | 0 | 70,980,373,934 | 100% | ||
betamusic | 0 | 35,729,590,145 | 100% | ||
profitgenerator | 0 | 46,030,471,056 | 100% | ||
steemit79 | 0 | 50,449,176 | 100% | ||
maarnio | 0 | 8,085,459,603 | 100% | ||
jacobts | 0 | 10,285,232,121 | 100% | ||
damarth | 0 | 451,304,990,366 | 100% | ||
jsg | 0 | 69,172,673,866 | 100% | ||
movietrailers | 0 | 2,545,836,136 | 100% | ||
bitcoinparadise | 0 | 19,640,981,775 | 100% | ||
statsbot | 0 | 77,291,486 | 100% | ||
newsbot | 0 | 77,274,929 | 100% | ||
crashoverride | 0 | 50,124,308 | 100% | ||
cartman | 0 | 249,749,818 | 100% | ||
thegame | 0 | 521,747,958 | 10% | ||
blacktier | 0 | 31,379,964,632 | 100% | ||
steembets | 0 | 633,352,347 | 10% | ||
dodders007 | 0 | 43,403,957,543 | 100% | ||
dickbutt | 0 | 117,660,092 | 100% | ||
thesteemawards | 0 | 193,655,381 | 20% | ||
peeweeherman | 0 | 123,334,242 | 100% | ||
cowboycurtis | 0 | 106,923,741 | 100% | ||
jambii | 0 | 106,904,671 | 100% | ||
coolcat | 0 | 186,662,085 | 100% | ||
opall | 0 | 185,982,055 | 100% | ||
elviss | 0 | 159,309,951 | 100% | ||
chair | 0 | 186,425,922 | 100% | ||
abdullar | 0 | 1,069,267,416,057 | 30% | ||
conky | 0 | 221,306,780 | 100% | ||
dademurphy | 0 | 184,950,284 | 100% | ||
chart | 0 | 184,105,542 | 100% | ||
mrssteve | 0 | 184,617,737 | 100% | ||
towelie | 0 | 638,508,779 | 100% | ||
philipjfry | 0 | 410,603,175 | 100% | ||
mrhanky | 0 | 183,077,339 | 100% | ||
popcornmachine | 0 | 182,965,147 | 100% | ||
wilburtsmythe | 0 | 182,554,439 | 100% | ||
bitrx | 0 | 182,178,170 | 100% | ||
bluetrade | 0 | 181,450,132 | 100% | ||
shape | 0 | 180,997,071 | 100% | ||
cryplectibles | 0 | 14,905,052,439 | 100% | ||
reddust | 0 | 66,732,197,284 | 100% | ||
highfive | 0 | 178,853,547 | 100% | ||
jebus | 0 | 178,766,457 | 100% | ||
clarence | 0 | 178,756,211 | 100% | ||
steemet | 0 | 177,862,964 | 100% | ||
qantheman | 0 | 176,657,347 | 100% | ||
charity | 0 | 175,548,477 | 100% | ||
annul | 0 | 175,431,211 | 100% | ||
suntzu | 0 | 174,201,801 | 100% | ||
mchammer | 0 | 174,167,449 | 100% | ||
vanilla | 0 | 173,377,625 | 100% | ||
guerilla | 0 | 173,161,144 | 100% | ||
icet | 0 | 173,008,860 | 100% | ||
nedd | 0 | 172,258,915 | 100% | ||
kickass | 0 | 171,588,522 | 100% | ||
oreo | 0 | 171,501,597 | 100% | ||
lalala | 0 | 2,565,126,964 | 100% | ||
steem-meme | 0 | 1,782,225,570 | 20% | ||
curei | 0 | 170,170,692 | 100% | ||
currie | 0 | 169,178,239 | 100% | ||
sunscape | 0 | 10,863,212,675 | 20% | ||
steemito | 0 | 187,972,869 | 100% | ||
austinpowers | 0 | 167,221,542 | 100% | ||
shapeshifter | 0 | 165,590,948 | 100% | ||
stun | 0 | 165,138,242 | 100% | ||
icecube | 0 | 164,520,632 | 100% | ||
view | 0 | 164,472,237 | 100% | ||
kitt | 0 | 163,093,425 | 100% | ||
katt | 0 | 162,866,577 | 100% | ||
itchy | 0 | 162,799,994 | 100% | ||
scratchy | 0 | 162,792,163 | 100% | ||
krusty | 0 | 162,528,976 | 100% | ||
scene | 0 | 162,203,027 | 100% | ||
fyrst-witness | 0 | 26,521,141,641 | 100% | ||
quimby | 0 | 160,741,915 | 100% | ||
wiggum | 0 | 162,858,181 | 100% | ||
sideshowbob | 0 | 159,558,073 | 100% | ||
drnick | 0 | 749,675,412 | 100% | ||
vladtheimpaler | 0 | 488,716,483 | 100% | ||
steemland.com | 0 | 531,204,775 | 10% | ||
angel76 | 0 | 16,392,781,398 | 100% | ||
sqube | 0 | 146,309,040,278 | 100% | ||
cathynsons | 0 | 15,181,447,096 | 100% | ||
crowdfundedwhale | 0 | 48,489,328,870 | 65% | ||
trans-juanmi | 0 | 5,889,023,290 | 60% | ||
breezin | 0 | 453,136,356 | 5% | ||
doodleman | 0 | 6,284,143,189 | 100% | ||
jonathanxvi | 0 | 7,764,035,100 | 100% | ||
fentan99 | 0 | 2,258,145,644 | 100% | ||
steemprentice | 0 | 17,889,804,503 | 30% | ||
spbesner | 0 | 5,731,295,861 | 100% | ||
helicopter | 0 | 657,554,648 | 100% | ||
soushi888 | 0 | 5,738,422,876 | 51% | ||
juliosalas | 0 | 837,256,672 | 60% | ||
ladder | 0 | 710,188,745 | 100% | ||
guytremat | 0 | 7,978,757,478 | 100% | ||
tamersameeh | 0 | 1,075,426,181 | 100% | ||
mathworksheets | 0 | 7,295,944,633 | 100% | ||
personz | 0 | 32,456,342,819 | 100% | ||
steemcenterwiki | 0 | 832,377,808 | 100% | ||
firesteem | 0 | 921,609,965 | 100% | ||
fbechstein | 0 | 5,689,967,271 | 100% | ||
corvuscoraxx | 0 | 910,361,062 | 90% | ||
cgame | 0 | 9,185,154,156 | 100% | ||
smalltalk | 0 | 321,050,453 | 10% | ||
tonylondon | 0 | 1,332,956,884 | 100% | ||
shaunmza | 0 | 8,025,567,445 | 80% | ||
evildeathcore | 0 | 3,320,574,211 | 100% | ||
hebrew | 0 | 8,581,899,314 | 100% | ||
hagbardceline | 0 | 29,868,275,272 | 100% | ||
akela | 0 | 3,211,372,958 | 100% | ||
anri-avgustino | 0 | 2,357,830,133 | 100% | ||
htooms | 0 | 865,048,472,709 | 40% | ||
thedegensloth | 0 | 7,033,614,264 | 100% | ||
lamdo2018 | 0 | 332,755,458 | 100% | ||
trafalgar | 0 | 2,883,730,895,484 | 100% | ||
kingsmind | 0 | 106,794,809 | 100% | ||
topengekspresi32 | 0 | 526,875,832 | 100% |
# <center>What is an API token?</center> ## An API token is a key that verifies the user is human with a time stamp. It has gps coordinates, fingerprint, and data that ties you "the user" to a machine, "your computer." ![image](https://i.imgur.com/qhHl6O6.jpg)
post_id | 2,335,377 |
---|---|
author | christoryan |
permlink | re-inertia-obarc-v0-5-2-openbazaar-ruby-api-client-201744t19542258z |
category | openbazaar |
json_metadata | "{"app": "esteem/1.4.0", "format": "markdown+html", "tags": "openbazaar"}" |
created | 2017-04-05 00:54:06 |
last_update | 2017-04-05 00:54:06 |
depth | 1 |
children | 2 |
net_rshares | 0 |
last_payout | 2017-04-12 00:54:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 266 |
author_reputation | 4,254,895,407,768 |
root_title | "OBarc v0.5.2 - OpenBazaar Ruby API Client #openbazzar" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Actually, in this case, you don't need an API token. You need an OpenBazaar server running on the latest version, configured with a username/password that the API client can use to connect.
post_id | 2,335,386 |
---|---|
author | inertia |
permlink | re-christoryan-re-inertia-obarc-v0-5-2-openbazaar-ruby-api-client-201744t19542258z-20170405t005814970z |
category | openbazaar |
json_metadata | "{"app": "steemit/0.1", "tags": ["openbazaar"]}" |
created | 2017-04-05 00:58:15 |
last_update | 2017-04-05 00:58:15 |
depth | 2 |
children | 1 |
net_rshares | 18,764,631,405 |
last_payout | 2017-04-12 00:58:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 190 |
author_reputation | 227,335,189,892,062 |
root_title | "OBarc v0.5.2 - OpenBazaar Ruby API Client #openbazzar" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
christoryan | 0 | 14,093,355,874 | 100% | ||
christoph3 | 0 | 4,671,275,531 | 100% |
Thanks to @madmax828 for the information that I rebuddled with on this post. @inettia Thank you for the heads up as some people do not know these things.
post_id | 2,335,463 |
---|---|
author | christoryan |
permlink | re-inertia-re-christoryan-re-inertia-obarc-v0-5-2-openbazaar-ruby-api-client-201744t19542258z-20170405t011322972z |
category | openbazaar |
json_metadata | "{"app": "steemit/0.1", "users": ["madmax828", "inettia"], "tags": ["openbazaar"]}" |
created | 2017-04-05 01:13:24 |
last_update | 2017-04-05 01:13:24 |
depth | 3 |
children | 0 |
net_rshares | 0 |
last_payout | 2017-04-12 01:13:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 153 |
author_reputation | 4,254,895,407,768 |
root_title | "OBarc v0.5.2 - OpenBazaar Ruby API Client #openbazzar" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Good job! You have a new follower.
post_id | 2,340,774 |
---|---|
author | hagbardceline |
permlink | re-inertia-obarc-v0-5-2-openbazaar-ruby-api-client-20170405t211004354z |
category | openbazaar |
json_metadata | "{"app": "steemit/0.1", "tags": ["openbazaar"]}" |
created | 2017-04-05 21:10:09 |
last_update | 2017-04-05 21:10:21 |
depth | 1 |
children | 0 |
net_rshares | 272,918,559,621 |
last_payout | 2017-04-12 21:10:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 34 |
author_reputation | 9,332,543,007,969 |
root_title | "OBarc v0.5.2 - OpenBazaar Ruby API Client #openbazzar" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
inertia | 0 | 272,165,761,294 | 100% | ||
tamersameeh | 0 | 752,798,327 | 100% |