earnshark_sdk 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 552517a7cffae1ded66990a624ed1bb2ea6b6caa
4
- data.tar.gz: 4f3ede03227f96cf25c01010abf70fa16fa98cbb
3
+ metadata.gz: 107bd08248d33f3f894d13e2a92545cc91662d24
4
+ data.tar.gz: 8d8be18a72dba4783ff29851ade2139e28b35866
5
5
  SHA512:
6
- metadata.gz: 4fe9f4dee46d71555d7f35f0039eda59f9bc180e88d1992c68ac93c4c9af35109785612ea046f19186bbdae384ef6d1919d3ac392e7810f5d2b8d643b4819348
7
- data.tar.gz: 0584538f553dabf7cd2d1bc7cc2f3f402ed4b8d4e3b1f3c8f6452d465b2d473636e932355906564a340054f43dc11b2d97d94ae969235366594eb2116b2520fc
6
+ metadata.gz: 656fa8ad75c41ab052d581fd60c63c8cd66ee316e6544728b78d7f392c8ae1f8196b3dd1505f4c22801bda18317c66a146300ed85dc05f98eb95f38f7c6f0db3
7
+ data.tar.gz: 7c0b7ad7cf3c58f05c5c7abc615b0f30d9e8172d7ce70886f9fc0aeca4c257e0d57eb3ecdbf12e4b4a021b10a27f68aebab75a0de9300df8d36418a540aa2e4e
data/Gemfile CHANGED
@@ -2,4 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in earnshark_sdk.gemspec
4
4
  gemspec
5
- gem "http"
5
+ gem "public_suffix", "1.4.6"
6
+ gem "http","1.0.4"
data/README.md CHANGED
@@ -1,10 +1,26 @@
1
1
  # Earnshark SDK for Ruby
2
+ ![sdk ruby](https://img.shields.io/badge/sdk-Ruby-ff69b4.svg)
3
+ [![Gem Version](https://badge.fury.io/rb/earnshark_sdk.svg)](https://badge.fury.io/rb/earnshark_sdk)
4
+ [![Join the chat at https://gitter.im/99xt/earnshark-sdk-js](https://badges.gitter.im/99xt/earnshark-sdk-js.svg)](https://gitter.im/99xt/earnshark-sdk-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+ [![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)
6
+ [![license](https://img.shields.io/npm/l/earnshark-sdk.svg)](https://www.npmjs.com/package/earnshark-sdk)
2
7
 
3
- This is a JavaScript SDK to call https://app.earnshark.com API. Contains methods to call the EarnShark API making the application integration fast.
8
+ 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.
4
9
 
5
- 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.
10
+ at RubyGems : https://rubygems.org/gems/earnshark_sdk
6
11
 
7
- TODO: Delete this and the text above, and describe your gem
12
+ ## Functions Available
13
+
14
+ * Accounts:
15
+ * get_account_information - Retrieve information on a particular account/subscription
16
+ * get_account_payments - Returns all the payment transactions associated with the account
17
+ * Licenses:
18
+ * get_license_information - Retrieve information on a particular license
19
+ * get_all_licenses_of_product - Retrieve all the license data for a particular product
20
+ * Subscriptions:
21
+ * new_subscription - Add a new subscription to a product
22
+ * renew_subscription - Renew/Update a Subscription
23
+ * get_payment_url - Returns the payment portal URL for a subscription(linked to PayPal)
8
24
 
9
25
  ## Installation
10
26
 
@@ -21,10 +37,90 @@ And then execute:
21
37
  Or install it yourself as:
22
38
 
23
39
  $ gem install earnshark_sdk
40
+
24
41
 
25
42
  ## Usage
26
43
 
27
- TODO: Write usage instructions here
44
+ Initiliaze the Object,
45
+
46
+ The token key and the product ID are required (this can be taken from the EarnShark dashboard)
47
+ ```ruby
48
+ key = ""
49
+ product_id = 9
50
+
51
+ ```
52
+
53
+ ```ruby
54
+ require 'earnshark_sdk/api'
55
+ earnshark = EarnShark::Api::Client.new(product_id, key)
56
+ ```
57
+
58
+ ### Add New Account
59
+ Creating new account, you need to pass the following data in the structure to the method
60
+ ```ruby
61
+ body = {
62
+ :account => {
63
+ :name =>"Account Name",
64
+ :email => "Account@example.com",
65
+ :accountID => "12345678",
66
+ :start_date => "01/01/2016"
67
+ },
68
+ :license_id => 17,
69
+ :enableNotifications => false,
70
+ :sendInvoiceNow => true
71
+ }
72
+ ```
73
+
74
+ ```ruby
75
+ addNewRes = earnshark.new_subscription(body)
76
+ ```
77
+
78
+ ### Get account information
79
+ You will need to pass the account id for this,
80
+
81
+ ```ruby
82
+ account_id = "123456"
83
+ accountInfo= earnshark.get_account_information(account_id)
84
+ ```
85
+
86
+ ### Renew a subscription with a new license
87
+ You will need to pass the current subscription id and the new license id to renew
88
+
89
+ ```ruby
90
+ subscription_id = 84
91
+ new_license_id = 20
92
+
93
+ renew_subs= earnshark.renew_subscription( subscription_id, new_license_id )
94
+ ```
95
+
96
+ ### Get license information for a single license
97
+ Get the license information using the license id and the license token
98
+
99
+ ```ruby
100
+ license_id = 17
101
+ license_token = ''
102
+
103
+ get_license= earnshark.get_license_information( license_id, license_token )
104
+ ```
105
+
106
+ ### Get all the licenses
107
+ Get all the licenses information
108
+ ```ruby
109
+ all_licenses= earnshark.get_all_licenses_of_product()
110
+ ```
111
+
112
+ ### Get Transaction details for an account
113
+ Retrieve the processed/unprocessed transactions for an account
114
+ ```ruby
115
+ account_transaction= earnshark.get_account_payments(account_id)
116
+ ```
117
+
118
+ ### Generate Payment URL to transfer to paymen gateway
119
+ Redirect URL is need to passed here as well
120
+ ```ruby
121
+ redirect = 'http://app.earnshark.com';
122
+ payment_url= earnshark.get_payment_url(account_id, redirect)
123
+ ```
28
124
 
29
125
  ## Development
30
126
 
data/Rakefile CHANGED
@@ -4,3 +4,7 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ task :console do
9
+ exec "irb -r earnshark_sdk -I ./lib"
10
+ end
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "earnshark_sdk"
4
+ #require "earnshark_sdk"
5
+ require "ruby/earnshark_sdk/api"
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -1,19 +1,28 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'earnshark_sdk/version'
4
+ require 'earnshark_sdk/api/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "earnshark_sdk"
8
- spec.version = EarnsharkSdk::VERSION
8
+ spec.version = EarnShark::Api::VERSION
9
9
  spec.authors = ["Chamath Palihawadana"]
10
10
  spec.email = ["chamathpali123@gmail.com"]
11
11
 
12
- spec.summary = %q{EarnShark SDK}
13
- spec.description = %q{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.}
12
+ spec.summary = "This is a Ruby SDK to call https://app.earnshark.com API endpoints"
13
+ spec.description = "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"
14
14
  spec.homepage = "https://github.com/99xt/earnshark-sdk-ruby"
15
15
  spec.license = "MIT"
16
16
 
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
17
26
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
27
  f.match(%r{^(test|spec|features)/})
19
28
  end
@@ -0,0 +1,48 @@
1
+ # Base ruby requirements
2
+ require "http"
3
+
4
+ # Gem requirements
5
+ require "earnshark_sdk/api/account"
6
+ require "earnshark_sdk/api/license"
7
+ require "earnshark_sdk/api/request"
8
+ require "earnshark_sdk/api/subscription"
9
+ require "earnshark_sdk/api/version"
10
+
11
+ module EarnShark
12
+ module Api
13
+ class Client
14
+ include Account
15
+ include License
16
+ include Request
17
+ include Subscription
18
+
19
+ #initialize the object with the earnshark product id and token provided
20
+ def initialize(product_id,key)
21
+ @product_id, @key = product_id , key
22
+ @base_url = BASE_URL
23
+ @app_dir = APP_DIR
24
+ end
25
+
26
+ def app_dir
27
+ @app_dir
28
+ end
29
+
30
+ def base_url
31
+ @base_url
32
+ end
33
+
34
+ def get_obj
35
+ "product_id = #@product_id , token = #@key"
36
+ end
37
+
38
+ def post(url, body)
39
+ HTTP.post(url, :json => body)
40
+ end
41
+
42
+ def get(url)
43
+ HTTP.get(url).body
44
+ end
45
+
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,18 @@
1
+ module EarnShark
2
+ module Account
3
+ # Get Account Information
4
+ # Example response:
5
+ # [ { "Date":"01/01/2016", "Cost":{ "value":"100", "currency":"USD" }, "Name":"5 Users Plan", "Product_ID":1, "Customer_ID":1, "Customer_Name":"Customer Name", "Account_ID":"123456", "Metadata":"{\"users\":\"10 users\"}", "Subscription_ID":1, "Tags":[ "10users" ], "License_ID":1, "Invalid":false, "Expired":false, "Billing_Cycle":{ "value":1, "type":"Monthly" }, "Description":"10 Users per month / 100", "Tenant_ID":"eu-west-1:00000000-0000-0000-0000-000000000000" } ]
6
+ def get_account_information(account_id)
7
+ get("#{base_url}#{@product_id}/subscriptioninfo/#{account_id}?key=#{@key}")
8
+ end
9
+
10
+ # Get the payment transactions for an account
11
+ # Example response:
12
+ # [ { "Amount":"100", "Created_At":"1474872974062", "Currency":"USD", "Product_ID":1, "PayPal_Transaction":"PAY-11111111111", "Updated_At":"1474872974062", "Account_ID":"local", "PayPal_Payer_ID":"111111", "Subscription_ID":1, "Payment_Processed":true, "Payout_ID":"12345", "Payment_Sent":true, "PayPal_Payment_ID":"PAY-11111111111" } ]'
13
+ def get_account_payments(account_id)
14
+ get("#{base_url}#{@product_id}/account/#{account_id}/transactions?key=#{@key}")
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module EarnShark
2
+ module License
3
+ # Get Information of a license created
4
+ # Example response:
5
+ # { "Name":"License Name", "Cost":{ "value":"100", "currency":"USD" }, "Tags":[ "10 User Package" ], "License_ID":1, "Product_ID":1, "Description":"10 Users per month / 100", "Billing_Cycle":{ "value":1, "type":"Monthly" }, "Metadata":"{\"users\":\"10\"}" }
6
+ def get_license_information(license_id, license_token)
7
+ get("#{base_url}#{@product_id}/license/#{license_id}/getlicensefromapi?key=#{license_token}")
8
+ end
9
+
10
+ # Get all the Licenses of the current product
11
+ # Example response:
12
+ # [{"Name":"License Name","Cost":{"value":"10","currency":"USD"},"Tags":["free","test","trial"],"License_ID":1,"Product_ID":1,"Description":"Test","Billing_Cycle":{"value":1,"type":"Monthly"},"Metadata":"{}"}]
13
+ def get_all_licenses
14
+ get("#{base_url}#{@product_id}/license/all?key=#{@key}")
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ module EarnShark
2
+ module Request
3
+ BASE_URL = 'https://app.earnshark.com/prod/product/'.freeze
4
+ APP_DIR = 'http://earnsharkbeta.com.s3-website-eu-west-1.amazonaws.com/'.freeze
5
+ end
6
+
7
+ =begin
8
+ def post(url, body)
9
+ HTTP.post(url, :json => body)
10
+ end
11
+
12
+ def get(url)
13
+ HTTP.get(url).body
14
+ end
15
+ =end
16
+
17
+ end
@@ -0,0 +1,23 @@
1
+ module EarnShark
2
+ module Subscription
3
+ # Adding new Subscription
4
+ # Example response:
5
+ # { "status":"success", "message":"Subscription created without notifications and without invoice" }
6
+ def new_subscription(body)
7
+ post("#{base_url}#{@product_id}/addsubscriptionfromapi?key=#{@key}", body)
8
+ end
9
+
10
+ # Renew an Existing subscription
11
+ # Example response:
12
+ # { "Date":"01/01/2016", "Cost":{ "value":"100", "currency":"USD" }, "Name":"5 Users Plan", "Product_ID":1, "Customer_ID":1, "Customer_Name":"Customer Name", "Account_ID":"123456", "Metadata":"{\"users\":\"10 users\"}", "Subscription_ID":1, "Tags":[ "10users" ], "License_ID":1, "Invalid":false, "Expired":false, "Billing_Cycle":{ "value":1, "type":"Monthly" }, "Description":"10 Users per month / 100", "Tenant_ID":"eu-west-1:00000000-0000-0000-0000-000000000000" }
13
+ def renew_subscription(subscription_id, new_license_id)
14
+ get("#{base_url}#@product_id/subscription/#{subscription_id}/apiRenewSubscription/#{new_license_id}?key=#@key")
15
+ end
16
+
17
+ # Get payment URL
18
+ def get_payment_url(account_id, redirect)
19
+ "#{app_dir}"+"payment.html?redirect=#{redirect}&productID=#@product_id&accountID=#{account_id}&key=#@key"
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module EarnShark
2
+ module Api
3
+ VERSION = "0.2.0".freeze
4
+ end
5
+ end
metadata CHANGED
@@ -1,68 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earnshark_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chamath Palihawadana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-27 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  description: This is a Ruby SDK to call https://app.earnshark.com API endpoints. Contains
56
- methods to call the EarnShark API making the application integration fast.
56
+ methods to call the EarnShark API making the application integration fast
57
57
  email:
58
58
  - chamathpali123@gmail.com
59
59
  executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
64
- - .rspec
65
- - .travis.yml
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
66
  - CODE_OF_CONDUCT.md
67
67
  - Gemfile
68
68
  - LICENSE.txt
@@ -71,30 +71,35 @@ files:
71
71
  - bin/console
72
72
  - bin/setup
73
73
  - earnshark_sdk.gemspec
74
- - lib/earnshark_sdk.rb
75
- - lib/earnshark_sdk/version.rb
74
+ - lib/earnshark_sdk/api.rb
75
+ - lib/earnshark_sdk/api/account.rb
76
+ - lib/earnshark_sdk/api/license.rb
77
+ - lib/earnshark_sdk/api/request.rb
78
+ - lib/earnshark_sdk/api/subscription.rb
79
+ - lib/earnshark_sdk/api/version.rb
76
80
  homepage: https://github.com/99xt/earnshark-sdk-ruby
77
81
  licenses:
78
82
  - MIT
79
- metadata: {}
83
+ metadata:
84
+ allowed_push_host: https://rubygems.org
80
85
  post_install_message:
81
86
  rdoc_options: []
82
87
  require_paths:
83
88
  - lib
84
89
  required_ruby_version: !ruby/object:Gem::Requirement
85
90
  requirements:
86
- - - '>='
91
+ - - ">="
87
92
  - !ruby/object:Gem::Version
88
93
  version: '0'
89
94
  required_rubygems_version: !ruby/object:Gem::Requirement
90
95
  requirements:
91
- - - '>='
96
+ - - ">="
92
97
  - !ruby/object:Gem::Version
93
98
  version: '0'
94
99
  requirements: []
95
100
  rubyforge_project:
96
- rubygems_version: 2.0.14.1
101
+ rubygems_version: 2.5.1
97
102
  signing_key:
98
103
  specification_version: 4
99
- summary: EarnShark SDK
104
+ summary: This is a Ruby SDK to call https://app.earnshark.com API endpoints
100
105
  test_files: []
data/lib/earnshark_sdk.rb DELETED
@@ -1,106 +0,0 @@
1
- require "earnshark_sdk/version"
2
- require "http"
3
-
4
- module EarnShark
5
- class API
6
-
7
- #initialize the object with the earnshark product id and token provided
8
- def initialize(product_id,key)
9
- @product_id, @key = product_id , key
10
- @isTest = false
11
- #URLS
12
- @baseURL = 'https://app.earnshark.com/prod/product/';
13
- @appDir = 'http://earnsharkbeta.com.s3-website-eu-west-1.amazonaws.com/';
14
- end
15
-
16
- def isTest(yes)
17
- if(yes)
18
- @isTest = true;
19
- end
20
- end
21
-
22
- # Adding new Subscription
23
- def add_new_subscription(body)
24
- # When test is true
25
- if(@isTest)
26
- '{ "status":"success", "message":"Subscription created without notifications and without invoice" }'
27
- else
28
- url = "#@baseURL#@product_id/addsubscriptionfromapi?key=#@key"
29
- response =HTTP.post( url , :json => body)
30
- "#{response}"
31
- end
32
-
33
- end
34
-
35
- # Get Account Information
36
- def get_account_information(account_id)
37
- # When test is true
38
- if(@isTest)
39
- '[ { "Date":"01/01/2016", "Cost":{ "value":"100", "currency":"USD" }, "Name":"5 Users Plan", "Product_ID":1, "Customer_ID":1, "Customer_Name":"Customer Name", "Account_ID":"123456", "Metadata":"{\"users\":\"10 users\"}", "Subscription_ID":1, "Tags":[ "10users" ], "License_ID":1, "Invalid":false, "Expired":false, "Billing_Cycle":{ "value":1, "type":"Monthly" }, "Description":"10 Users per month / 100", "Tenant_ID":"eu-west-1:00000000-0000-0000-0000-000000000000" } ]'
40
- else
41
- url = "#@baseURL#@product_id/subscriptioninfo/#{account_id}?key=#@key"
42
- response = HTTP.get(url).body
43
- "#{response}"
44
- end
45
- end
46
-
47
- # Get Information of a license created
48
- def get_license_information(license_id, license_token)
49
- # When test is true
50
- if(@isTest)
51
- '{ "Name":"License Name", "Cost":{ "value":"100", "currency":"USD" }, "Tags":[ "10 User Package" ], "License_ID":1, "Product_ID":1, "Description":"10 Users per month / 100", "Billing_Cycle":{ "value":1, "type":"Monthly" }, "Metadata":"{\"users\":\"10\"}" }'
52
- else
53
- url = "#@baseURL#@product_id/license/#{license_id}/getlicensefromapi?key=#{license_token}"
54
- response = HTTP.get(url).body
55
- "#{response}"
56
- end
57
- end
58
-
59
- # Renew an Existing subscription
60
- def renew_subscription(subscription_id, new_license_id)
61
- # When test is true
62
- if(@isTest)
63
- '{ "Date":"01/01/2016", "Cost":{ "value":"100", "currency":"USD" }, "Name":"5 Users Plan", "Product_ID":1, "Customer_ID":1, "Customer_Name":"Customer Name", "Account_ID":"123456", "Metadata":"{\"users\":\"10 users\"}", "Subscription_ID":1, "Tags":[ "10users" ], "License_ID":1, "Invalid":false, "Expired":false, "Billing_Cycle":{ "value":1, "type":"Monthly" }, "Description":"10 Users per month / 100", "Tenant_ID":"eu-west-1:00000000-0000-0000-0000-000000000000" }'
64
- else
65
- url = "#@baseURL#@product_id/subscription/#{subscription_id}/apiRenewSubscription/#{new_license_id}?key=#@key"
66
- response = HTTP.get(url).body
67
- "#{response}"
68
- end
69
- end
70
-
71
-
72
- # Get all the Licenses of the current product
73
- def get_all_licenses_of_product()
74
- # When test is true
75
- if(@isTest)
76
- '[{"Name":"License Name","Cost":{"value":"10","currency":"USD"},"Tags":["free","test","trial"],"License_ID":1,"Product_ID":1,"Description":"Test","Billing_Cycle":{"value":1,"type":"Monthly"},"Metadata":"{}"}]'
77
- else
78
- url = "#@baseURL#@product_id/license/all?key=#@key"
79
- response = HTTP.get(url).body
80
- "#{response}"
81
- end
82
- end
83
-
84
- # Get the payment transactions for an account
85
- def get_account_payments(account_id)
86
- # When test is true
87
- if(@isTest)
88
- '[ { "Amount":"100", "Created_At":"1474872974062", "Currency":"USD", "Product_ID":1, "PayPal_Transaction":"PAY-11111111111", "Updated_At":"1474872974062", "Account_ID":"local", "PayPal_Payer_ID":"111111", "Subscription_ID":1, "Payment_Processed":true, "Payout_ID":"12345", "Payment_Sent":true, "PayPal_Payment_ID":"PAY-11111111111" } ]'
89
- else
90
- url = "#@baseURL#@product_id/account/#{account_id}/transactions?key=#@key"
91
- response = HTTP.get(url).body
92
- "#{response}"
93
- end
94
- end
95
-
96
- # Get payment URL
97
- def get_payment_url(account_id, redirect)
98
- "#@appDir"+"payment.html?redirect=#{redirect}&productID=#@product_id&accountID=#{account_id}&key=#@key"
99
- end
100
-
101
- def get_obj
102
- "product_id = #@product_id , token = #@key , isTest = #@isTest"
103
- end
104
-
105
- end
106
- end
@@ -1,3 +0,0 @@
1
- module EarnsharkSdk
2
- VERSION = "0.1.0"
3
- end