README.md in earnshark_sdk-0.1.0 vs README.md in earnshark_sdk-0.2.0
- old
+ new
@@ -1,13 +1,29 @@
# Earnshark SDK for Ruby
+
+[](https://badge.fury.io/rb/earnshark_sdk)
+[](https://gitter.im/99xt/earnshark-sdk-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[](http://www.serverless.com)
+[](https://www.npmjs.com/package/earnshark-sdk)
-This is a JavaScript SDK to call https://app.earnshark.com API. Contains methods to call the EarnShark API making the application integration fast.
+This is a Ruby SDK to call https://app.earnshark.com API endpoints. Contains methods to call the EarnShark API making the application integration fast.
-Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/earnshark_sdk`. To experiment with that code, run `bin/console` for an interactive prompt.
+at RubyGems : https://rubygems.org/gems/earnshark_sdk
-TODO: Delete this and the text above, and describe your gem
+## Functions Available
+* Accounts:
+ * get_account_information - Retrieve information on a particular account/subscription
+ * get_account_payments - Returns all the payment transactions associated with the account
+* Licenses:
+ * get_license_information - Retrieve information on a particular license
+ * get_all_licenses_of_product - Retrieve all the license data for a particular product
+* Subscriptions:
+ * new_subscription - Add a new subscription to a product
+ * renew_subscription - Renew/Update a Subscription
+ * get_payment_url - Returns the payment portal URL for a subscription(linked to PayPal)
+
## Installation
Add this line to your application's Gemfile:
```ruby
@@ -19,13 +35,93 @@
$ bundle
Or install it yourself as:
$ gem install earnshark_sdk
+
## Usage
-TODO: Write usage instructions here
+Initiliaze the Object,
+
+The token key and the product ID are required (this can be taken from the EarnShark dashboard)
+```ruby
+key = ""
+product_id = 9
+
+```
+
+```ruby
+require 'earnshark_sdk/api'
+earnshark = EarnShark::Api::Client.new(product_id, key)
+```
+
+### Add New Account
+Creating new account, you need to pass the following data in the structure to the method
+```ruby
+body = {
+ :account => {
+ :name =>"Account Name",
+ :email => "Account@example.com",
+ :accountID => "12345678",
+ :start_date => "01/01/2016"
+ },
+ :license_id => 17,
+ :enableNotifications => false,
+ :sendInvoiceNow => true
+ }
+```
+
+```ruby
+addNewRes = earnshark.new_subscription(body)
+```
+
+### Get account information
+You will need to pass the account id for this,
+
+```ruby
+account_id = "123456"
+accountInfo= earnshark.get_account_information(account_id)
+```
+
+### Renew a subscription with a new license
+You will need to pass the current subscription id and the new license id to renew
+
+```ruby
+subscription_id = 84
+new_license_id = 20
+
+renew_subs= earnshark.renew_subscription( subscription_id, new_license_id )
+```
+
+### Get license information for a single license
+Get the license information using the license id and the license token
+
+```ruby
+license_id = 17
+license_token = ''
+
+get_license= earnshark.get_license_information( license_id, license_token )
+```
+
+### Get all the licenses
+Get all the licenses information
+```ruby
+all_licenses= earnshark.get_all_licenses_of_product()
+```
+
+### Get Transaction details for an account
+Retrieve the processed/unprocessed transactions for an account
+```ruby
+account_transaction= earnshark.get_account_payments(account_id)
+```
+
+### Generate Payment URL to transfer to paymen gateway
+Redirect URL is need to passed here as well
+```ruby
+redirect = 'http://app.earnshark.com';
+payment_url= earnshark.get_payment_url(account_id, redirect)
+```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.