earnshark_sdk 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -9
- data/.rspec +2 -2
- data/.travis.yml +5 -5
- data/CODE_OF_CONDUCT.md +74 -74
- data/CONTRIBUTING.md +52 -0
- data/Gemfile +5 -5
- data/LICENSE.txt +21 -21
- data/README.md +138 -138
- data/Rakefile +10 -10
- data/bin/console +15 -15
- data/bin/setup +8 -8
- data/earnshark_sdk.gemspec +36 -36
- data/lib/earnshark_sdk/api/account.rb +18 -18
- data/lib/earnshark_sdk/api/license.rb +18 -18
- data/lib/earnshark_sdk/api/request.rb +6 -17
- data/lib/earnshark_sdk/api/subscription.rb +30 -23
- data/lib/earnshark_sdk/api/version.rb +5 -5
- data/lib/earnshark_sdk/api.rb +48 -48
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d94c0a4cd2cd9204b42f5d40ecfc59768477382d
|
4
|
+
data.tar.gz: 7378d4d58129be5686965b957cfbaff6f5bf4875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 046f32bfe87ccb8dbfcf1f5c0b8e52efaa66dec95170409696b793e6ec3bf3f09c4cddaf39eb4beec07699c90a3fbfcde26d4ce3268d833c09d58c8aa670bde4
|
7
|
+
data.tar.gz: 66f5f8d011b0c93c69ac23539600fbcf9ffac176abe815956b53bdb8cbf17a5834ad78cdd9c31732da91a4911b0d5b31122f0b121384ac83a08e1fded599c55b
|
data/.gitignore
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format documentation
|
2
|
-
--color
|
1
|
+
--format documentation
|
2
|
+
--color
|
data/.travis.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.0.0
|
5
|
-
before_install: gem install bundler -v 1.13.5
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.0.0
|
5
|
+
before_install: gem install bundler -v 1.13.5
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,74 +1,74 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at chamathpali123@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at chamathpali123@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
Contributing
|
2
|
+
When contributing to this repository, please first discuss the change you wish to make via issue or on [gitter chat] (https://gitter.im/99xt/earnshark-sdk-ruby) before making a change.
|
3
|
+
|
4
|
+
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
5
|
+
|
6
|
+
Pull Request Process
|
7
|
+
|
8
|
+
Ensure any install or build dependencies are removed before the end of the layer when doing a build.
|
9
|
+
Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
|
10
|
+
Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is SemVer.
|
11
|
+
You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
|
12
|
+
Code of Conduct
|
13
|
+
|
14
|
+
Our Pledge
|
15
|
+
|
16
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
17
|
+
|
18
|
+
Our Standards
|
19
|
+
|
20
|
+
Examples of behavior that contributes to creating a positive environment include:
|
21
|
+
|
22
|
+
Using welcoming and inclusive language
|
23
|
+
Being respectful of differing viewpoints and experiences
|
24
|
+
Gracefully accepting constructive criticism
|
25
|
+
Focusing on what is best for the community
|
26
|
+
Showing empathy towards other community members
|
27
|
+
Examples of unacceptable behavior by participants include:
|
28
|
+
|
29
|
+
The use of sexualized language or imagery and unwelcome sexual attention or advances
|
30
|
+
Trolling, insulting/derogatory comments, and personal or political attacks
|
31
|
+
Public or private harassment
|
32
|
+
Publishing others' private information, such as a physical or electronic address, without explicit permission
|
33
|
+
Other conduct which could reasonably be considered inappropriate in a professional setting
|
34
|
+
Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
37
|
+
|
38
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
39
|
+
|
40
|
+
Scope
|
41
|
+
|
42
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
43
|
+
|
44
|
+
Enforcement
|
45
|
+
|
46
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [99xt@googlegroups.com]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
47
|
+
|
48
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
49
|
+
|
50
|
+
Attribution
|
51
|
+
|
52
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in earnshark_sdk.gemspec
|
4
|
-
gemspec
|
5
|
-
gem "public_suffix", "1.4.6"
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in earnshark_sdk.gemspec
|
4
|
+
gemspec
|
5
|
+
gem "public_suffix", "1.4.6"
|
6
6
|
gem "http","1.0.4"
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Chamath Palihawadana
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Chamath Palihawadana
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,138 +1,138 @@
|
|
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)
|
7
|
-
|
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.
|
9
|
-
|
10
|
-
at RubyGems : https://rubygems.org/gems/earnshark_sdk
|
11
|
-
|
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)
|
24
|
-
|
25
|
-
## Installation
|
26
|
-
|
27
|
-
Add this line to your application's Gemfile:
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
gem 'earnshark_sdk'
|
31
|
-
```
|
32
|
-
|
33
|
-
And then execute:
|
34
|
-
|
35
|
-
$ bundle
|
36
|
-
|
37
|
-
Or install it yourself as:
|
38
|
-
|
39
|
-
$ gem install earnshark_sdk
|
40
|
-
|
41
|
-
|
42
|
-
## Usage
|
43
|
-
|
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
|
-
```
|
124
|
-
|
125
|
-
## Development
|
126
|
-
|
127
|
-
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.
|
128
|
-
|
129
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
130
|
-
|
131
|
-
## Contributing
|
132
|
-
|
133
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/99xt/earnshark-sdk-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
134
|
-
|
135
|
-
## License
|
136
|
-
|
137
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
138
|
-
|
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)
|
7
|
+
|
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.
|
9
|
+
|
10
|
+
at RubyGems : https://rubygems.org/gems/earnshark_sdk
|
11
|
+
|
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)
|
24
|
+
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
Add this line to your application's Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'earnshark_sdk'
|
31
|
+
```
|
32
|
+
|
33
|
+
And then execute:
|
34
|
+
|
35
|
+
$ bundle
|
36
|
+
|
37
|
+
Or install it yourself as:
|
38
|
+
|
39
|
+
$ gem install earnshark_sdk
|
40
|
+
|
41
|
+
|
42
|
+
## Usage
|
43
|
+
|
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
|
+
```
|
124
|
+
|
125
|
+
## Development
|
126
|
+
|
127
|
+
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.
|
128
|
+
|
129
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
130
|
+
|
131
|
+
## Contributing
|
132
|
+
|
133
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/99xt/earnshark-sdk-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
134
|
+
|
135
|
+
## License
|
136
|
+
|
137
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
138
|
+
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
task :default => :spec
|
7
|
-
|
8
|
-
task :console do
|
9
|
-
exec "irb -r earnshark_sdk -I ./lib"
|
10
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
task :console do
|
9
|
+
exec "irb -r earnshark_sdk -I ./lib"
|
10
|
+
end
|
data/bin/console
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
#require "earnshark_sdk"
|
5
|
-
require "ruby/earnshark_sdk/api"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
#require "earnshark_sdk"
|
5
|
+
require "ruby/earnshark_sdk/api"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
data/earnshark_sdk.gemspec
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'earnshark_sdk/api/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "earnshark_sdk"
|
8
|
-
spec.version = EarnShark::Api::VERSION
|
9
|
-
spec.authors = ["Chamath Palihawadana"]
|
10
|
-
spec.email = ["chamathpali123@gmail.com"]
|
11
|
-
|
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
|
-
spec.homepage = "https://github.com/99xt/earnshark-sdk-ruby"
|
15
|
-
spec.license = "MIT"
|
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
|
-
|
26
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
-
f.match(%r{^(test|spec|features)/})
|
28
|
-
end
|
29
|
-
spec.bindir = "exe"
|
30
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
spec.add_development_dependency "bundler", "~> 1.13"
|
34
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'earnshark_sdk/api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "earnshark_sdk"
|
8
|
+
spec.version = EarnShark::Api::VERSION
|
9
|
+
spec.authors = ["Chamath Palihawadana", "Niveditha Karmegam"]
|
10
|
+
spec.email = ["chamathpali123@gmail.com", "kniveditha777@gmail.com"]
|
11
|
+
|
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
|
+
spec.homepage = "https://github.com/99xt/earnshark-sdk-ruby"
|
15
|
+
spec.license = "MIT"
|
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
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
end
|
@@ -1,18 +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}
|
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}
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
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/#{@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/#{@product_id}/account/#{account_id}/transactions?key=#{@key}")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -1,18 +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}
|
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}
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
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/#{@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/#{@product_id}/license/all?key=#{@key}")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -1,17 +1,6 @@
|
|
1
|
-
module EarnShark
|
2
|
-
module Request
|
3
|
-
BASE_URL = 'https://app.earnshark.com/prod/
|
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
|
1
|
+
module EarnShark
|
2
|
+
module Request
|
3
|
+
BASE_URL = 'https://app.earnshark.com/prod/'.freeze
|
4
|
+
APP_DIR = 'http://earnsharkbeta.com.s3-website-eu-west-1.amazonaws.com/'.freeze
|
5
|
+
end
|
6
|
+
end
|
@@ -1,23 +1,30 @@
|
|
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}
|
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}
|
15
|
-
end
|
16
|
-
|
17
|
-
# Get payment URL
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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/#{@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/#@product_id/subscription/#{subscription_id}/apiRenewSubscription/#{new_license_id}?key=#@key")
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get payment URL
|
18
|
+
# Example response:
|
19
|
+
# {"url":"http://app.earnshark.com.s3-website-eu-west-1.amazonaws.com/payments.html?transactionID=XXXXXXXXX"}
|
20
|
+
def get_payment_url(account_id, redirect)
|
21
|
+
body = { :redirect => redirect,
|
22
|
+
:account_id => account_id,
|
23
|
+
:product_id => @product_id,
|
24
|
+
:key => @key
|
25
|
+
}
|
26
|
+
post("#{base_url}/payments/getTransactionID", body)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module EarnShark
|
2
|
-
module Api
|
3
|
-
VERSION = "0.2.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module EarnShark
|
2
|
+
module Api
|
3
|
+
VERSION = "0.2.1".freeze
|
4
|
+
end
|
5
|
+
end
|
data/lib/earnshark_sdk/api.rb
CHANGED
@@ -1,48 +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
|
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
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: earnshark_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chamath Palihawadana
|
8
|
+
- Niveditha Karmegam
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -56,6 +57,7 @@ description: This is a Ruby SDK to call https://app.earnshark.com API endpoints.
|
|
56
57
|
methods to call the EarnShark API making the application integration fast
|
57
58
|
email:
|
58
59
|
- chamathpali123@gmail.com
|
60
|
+
- kniveditha777@gmail.com
|
59
61
|
executables: []
|
60
62
|
extensions: []
|
61
63
|
extra_rdoc_files: []
|
@@ -64,6 +66,7 @@ files:
|
|
64
66
|
- ".rspec"
|
65
67
|
- ".travis.yml"
|
66
68
|
- CODE_OF_CONDUCT.md
|
69
|
+
- CONTRIBUTING.md
|
67
70
|
- Gemfile
|
68
71
|
- LICENSE.txt
|
69
72
|
- README.md
|
@@ -98,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
101
|
version: '0'
|
99
102
|
requirements: []
|
100
103
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.5.
|
104
|
+
rubygems_version: 2.5.2
|
102
105
|
signing_key:
|
103
106
|
specification_version: 4
|
104
107
|
summary: This is a Ruby SDK to call https://app.earnshark.com API endpoints
|