README.md in gocoin-0.1.2 vs README.md in gocoin-0.1.3

- old
+ new

@@ -1,12 +1,9 @@ # gocoin-ruby A Ruby gem for the GoCoin API. -#### NOTICE: -This code is highly experimental. If you are interested in GoCoin, please contact kevin@gocoin.com - ## Installation ``` ruby gem 'gocoin' ``` @@ -37,33 +34,36 @@ scope: 'user_read_write invoice_read_write', state: 'state_token_you_provide' ) ``` +You then need to either use an HTTP client to GET the URL returned by construct_code_url or paste it into your browser and manually copy the RETURNED_CODE in the redirect (see below). + The redirect will return the code as a parameter in the URL. For example: https://myapp.com?code=RETURNED_CODE&state=state_token_you_provide + Call Client#authenticate with the code as a parameter to retrieve a persistent token with the requests grant permissions. ``` ruby token = gocoin_client.authenticate( code: CODE ) gocoin_client.token = token[:access_token] ``` -Note that token[:access_token] should be stored in your app if you wish to avoid the authentication procedure each time the app is used. +Note that token[:access_token] should be stored in your app if you wish to avoid the authentication procedure each time the app is used. Once you have a valid access token, you can make all of the following API calls. -#### Retrieve user data from the API. +#### Retrieve user data ``` ruby # Gocoin::User#self() # Require user_read or user_read_write privilege user_self = gocoin_client.user.self # Gocoin::User#get(id) same_user = gocoin_client.user.get(user_self[:id]) ``` -#### Update user data. +#### Update user data ``` ruby # Gocoin::User#update(id, params = {}) # Requires user_read_write grant_type gocoin_client.user.update( user_self[:id], @@ -147,11 +147,11 @@ callback_url: "https://myapp.com/gocoin/callback", redirect_url: "https://myapp.com/redirect" ) ``` -#### Retrieve invoices from the API +#### Retrieve invoices ``` ruby # Gocoin::Invoices#get(id) retrieved_invoice = gocoin_client.invoices.get(created_invoice[:id] @@ -164,24 +164,13 @@ page: 1, per_page: 20 ) ``` -#### Request a payout +#### Retrieve existing payout details ``` ruby -# Gocoin::Merchant::Payouts#request(merchant_id, params) -# Requires merchant_read_write privilege -requested_payout = gocoin_client.merchant.payouts.request( merchant_id, - currency_code: "BTC", - amount: 10 -) -``` - -#### Retrieve existing payout requests - -``` ruby # Gocoin::Merchant::Payouts#get(merchant_id, payout_id) # Requires merchant_read_write privilege existing_payout = gocoin_client.merchant.payouts.get( merchant_id, payout_id ) ``` @@ -189,22 +178,10 @@ # Gocoin::Merchant::Payouts#list(merchant_id) # Requires merchant_read_write privilege existing_payouts = gocoin_client.merchant.payouts.list( merchant_id ) ``` -#### Request a currency conversion - -``` ruby -# Gocoin::Merchant::CurrencyConversions#request(merchant_id, params) -# Requires merchant_read_write privilege -requested_currency_conversion = gocoin_client.merchant.currency_conversions.request( merchant_id, - base_currency: "BTC", - base_currency_amount: 10, - final_currency: "USD" -) -``` - -#### Retrieve existing currency conversion requests +#### Retrieve existing currency conversion details ``` ruby # Gocoin::Merchant::CurrencyConversions#get(merchant_id, currency_conversion_id) # Requires merchant_read_write privilege existing_currency_conversion = gocoin_client.merchant.currency_conversions.get( merchant_id, currency_conversion_id )