rally_up 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +71 -0
- data/LICENSE +21 -0
- data/README.md +64 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rally_up.rb +66 -0
- data/lib/rally_up/list_object.rb +24 -0
- data/lib/rally_up/partner.rb +28 -0
- data/lib/rally_up/partner/campaign.rb +72 -0
- data/lib/rally_up/partner/campaign_item.rb +45 -0
- data/lib/rally_up/partner/organization.rb +43 -0
- data/lib/rally_up/partner/token.rb +32 -0
- data/lib/rally_up/version.rb +5 -0
- data/rally_up.gemspec +35 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b2bd64acb8f9af4b14ca1914980d050fbf2d54dbb778c53be9da3ad0275d97a5
|
4
|
+
data.tar.gz: cc97a5baa89a8447121f8aab2616f702adb7dbe2ce2f455403eb29403ea37523
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c450d30ba3e7fedd22f8cfa29fc644038675a8355f580f4bb2f43d968d4b53cb00c483c8be09db4a66ff6d92967bebabdb55bdb58918f23e9d9c9cbb0a2e9bf
|
7
|
+
data.tar.gz: 53974266d61f735f684117ea2620d90d00c2cfc57b674ffb96ae262dc2f6d31588c4dd3f0a7ddd2f37e9ca58cb663521440b7cb7984e43ae1b5f6a88bd4aad6d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rally_up (1.0.0)
|
5
|
+
http (~> 4.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
coderay (1.1.3)
|
13
|
+
crack (0.4.4)
|
14
|
+
diff-lcs (1.4.4)
|
15
|
+
domain_name (0.5.20190701)
|
16
|
+
unf (>= 0.0.5, < 1.0.0)
|
17
|
+
ffi (1.13.1)
|
18
|
+
ffi-compiler (1.0.1)
|
19
|
+
ffi (>= 1.0.0)
|
20
|
+
rake
|
21
|
+
hashdiff (1.0.1)
|
22
|
+
http (4.4.1)
|
23
|
+
addressable (~> 2.3)
|
24
|
+
http-cookie (~> 1.0)
|
25
|
+
http-form_data (~> 2.2)
|
26
|
+
http-parser (~> 1.2.0)
|
27
|
+
http-cookie (1.0.3)
|
28
|
+
domain_name (~> 0.5)
|
29
|
+
http-form_data (2.3.0)
|
30
|
+
http-parser (1.2.2)
|
31
|
+
ffi-compiler
|
32
|
+
method_source (1.0.0)
|
33
|
+
pry (0.13.1)
|
34
|
+
coderay (~> 1.1)
|
35
|
+
method_source (~> 1.0)
|
36
|
+
public_suffix (4.0.6)
|
37
|
+
rake (12.3.3)
|
38
|
+
rspec (3.9.0)
|
39
|
+
rspec-core (~> 3.9.0)
|
40
|
+
rspec-expectations (~> 3.9.0)
|
41
|
+
rspec-mocks (~> 3.9.0)
|
42
|
+
rspec-core (3.9.3)
|
43
|
+
rspec-support (~> 3.9.3)
|
44
|
+
rspec-expectations (3.9.2)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.9.0)
|
47
|
+
rspec-mocks (3.9.1)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-support (3.9.3)
|
51
|
+
unf (0.1.4)
|
52
|
+
unf_ext
|
53
|
+
unf_ext (0.0.7.7)
|
54
|
+
webmock (3.9.2)
|
55
|
+
addressable (>= 2.3.6)
|
56
|
+
crack (>= 0.3.2)
|
57
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
bundler (~> 2.0)
|
64
|
+
pry
|
65
|
+
rake (~> 12.0)
|
66
|
+
rally_up!
|
67
|
+
rspec
|
68
|
+
webmock
|
69
|
+
|
70
|
+
BUNDLED WITH
|
71
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 MemberHub
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# RallyUp Ruby Library
|
2
|
+
|
3
|
+
The RallyUp ruby library provides a ruby wrapping around the [RallyUp API](https://api.rallyup.com/) and the [RallyUp Partner API](https://partnerapi.rallyup.com/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rally_up'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rally_up
|
20
|
+
|
21
|
+
## API Usage
|
22
|
+
|
23
|
+
```
|
24
|
+
require 'rally_up'
|
25
|
+
```
|
26
|
+
|
27
|
+
## Partner API Usage
|
28
|
+
|
29
|
+
```
|
30
|
+
require 'rally_up'
|
31
|
+
|
32
|
+
# Setup your Partner API Variable
|
33
|
+
RallyUp::Partner.domain = 'my.partnerdomain.com'
|
34
|
+
RallyUp::Partner.login = 'login'
|
35
|
+
RallyUp::Partner.secret = 's3cr3t'
|
36
|
+
|
37
|
+
# Authorization
|
38
|
+
RallyUp::Partner::Token.retrieve
|
39
|
+
RallyUp::Partner::Token.retrieve(set: false) # to not change RallyUp::Partner.token value
|
40
|
+
|
41
|
+
# Once authorized, use the Partner API...
|
42
|
+
|
43
|
+
# Campaigns
|
44
|
+
RallyUp::Partner::Campaign.list(organization_id: 123)
|
45
|
+
RallyUp::Partner::Campaign.retrieve(12345)
|
46
|
+
|
47
|
+
# Campaign Items
|
48
|
+
RallyUp::Partner::CampaignItem.list(123)
|
49
|
+
|
50
|
+
# Organizations
|
51
|
+
RallyUp::Partner::Organization.list
|
52
|
+
RallyUp::Partner::Organization.list(start_date: '2020-01-01', end_date: '2020-01-30')
|
53
|
+
RallyUp::Partner::Organization.retrieve(12345)
|
54
|
+
```
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
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.
|
59
|
+
|
60
|
+
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).
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/memberhubteam/rally_up.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rally_up"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/rally_up.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rally_up/version'
|
4
|
+
require 'rally_up/list_object'
|
5
|
+
require 'http'
|
6
|
+
require 'cgi'
|
7
|
+
|
8
|
+
module RallyUp
|
9
|
+
class << self
|
10
|
+
def included(base)
|
11
|
+
base.extend Request
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Request
|
16
|
+
def delete(path, params: {}, headers: {})
|
17
|
+
request(:delete, path, params: params, headers: headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get(path, params: {}, headers: {})
|
21
|
+
request(:get, path, params: params, headers: headers)
|
22
|
+
end
|
23
|
+
|
24
|
+
def post(path, params: {}, headers: {})
|
25
|
+
request(:post, path, params: params, headers: headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def put(path, params: {}, headers: {})
|
29
|
+
request(:put, path, params: params, headers: headers)
|
30
|
+
end
|
31
|
+
|
32
|
+
def request(method, path, domain: 'go.rallyup.com', params: {}, headers: {})
|
33
|
+
request_params = method == :get ? { params: params } : { body: URI.encode_www_form(params) }
|
34
|
+
response = HTTP.headers(headers).send(method, "https://#{domain}#{path}", request_params)
|
35
|
+
verify!(response)
|
36
|
+
response
|
37
|
+
end
|
38
|
+
|
39
|
+
def json(method, path, params: {}, headers: {})
|
40
|
+
response = request(method, path, params: params, headers: headers)
|
41
|
+
JSON.parse(response, symbolize_names: true)
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
|
46
|
+
def verify!(response)
|
47
|
+
return if response.code.to_i == 200
|
48
|
+
|
49
|
+
raise Error, response
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class Error < StandardError
|
54
|
+
attr_accessor :code, :body
|
55
|
+
def initialize(response)
|
56
|
+
@body = response.body
|
57
|
+
@code = response.code
|
58
|
+
end
|
59
|
+
|
60
|
+
def message
|
61
|
+
"#{code} #{body}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
require 'rally_up/partner'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RallyUp
|
4
|
+
class ListObject
|
5
|
+
attr_reader :json, :items, :count, :page_index, :page_size,
|
6
|
+
:total_count, :total_pages,
|
7
|
+
:has_previous_page, :has_next_page
|
8
|
+
def initialize(json_response, klass)
|
9
|
+
@json = json_response
|
10
|
+
if klass
|
11
|
+
@items = json.dig(:Result, :Items).to_a.map do |data|
|
12
|
+
klass.new(data)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
@count = json_response.dig(:Result, :Count)
|
16
|
+
@page_index = json_response.dig(:Result, :PageIndex)
|
17
|
+
@page_size = json_response.dig(:Result, :PageSize)
|
18
|
+
@total_count = json_response.dig(:Result, :TotalCount)
|
19
|
+
@total_pages = json_response.dig(:Result, :TotalPages)
|
20
|
+
@has_previous_page = json_response.dig(:Result, :HasPreviousPage)
|
21
|
+
@has_next_page = json_response.dig(:Result, :HasNextPage)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RallyUp
|
4
|
+
module Partner
|
5
|
+
include RallyUp
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_accessor :login, :secret, :domain, :token
|
9
|
+
|
10
|
+
def request(method, path, domain: RallyUp::Partner.domain, params: {}, headers: {})
|
11
|
+
raise 'Missing RallyUp Partner Token' if RallyUp::Partner.nil?
|
12
|
+
|
13
|
+
super(
|
14
|
+
method,
|
15
|
+
path,
|
16
|
+
domain: domain,
|
17
|
+
params: params,
|
18
|
+
headers: headers.merge('Authorization' => "Bearer #{RallyUp::Partner.token}")
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'rally_up/partner/token'
|
26
|
+
require 'rally_up/partner/campaign'
|
27
|
+
require 'rally_up/partner/campaign_item'
|
28
|
+
require 'rally_up/partner/organization'
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RallyUp
|
4
|
+
module Partner
|
5
|
+
class Campaign
|
6
|
+
attr_accessor :id, :name, :url, :campaign_setup_url, :campaign_status,
|
7
|
+
:start_date_utc, :end_date_utc, :amount_raised,
|
8
|
+
:amount_raised_in_period, :amount_goal, :goal_period,
|
9
|
+
:total_views, :total_supporters, :organization_id,
|
10
|
+
:organization_name, :timezone_name, :utcoffset_minutes,
|
11
|
+
:time_remaining_minutes, :thumbnail_url, :cta_label,
|
12
|
+
:management_pages, :primary_currency, :currency_symbol,
|
13
|
+
:project_id, :fund_code
|
14
|
+
|
15
|
+
def initialize(json)
|
16
|
+
@id = json[:Id]
|
17
|
+
@name = json[:Name]
|
18
|
+
@url = json[:Url]
|
19
|
+
@campaign_setup_url = json[:CampaignSetupUrl]
|
20
|
+
@campaign_status = json[:CampaignStatus]
|
21
|
+
@start_date_utc = json[:StartDateUtc]
|
22
|
+
@end_date_utc = json[:EndDateUtc]
|
23
|
+
@amount_raised = json[:AmountRaised]
|
24
|
+
@amount_raised_in_period = json[:AmountRaisedInPeriod]
|
25
|
+
@amount_goal = json[:AmountGoal]
|
26
|
+
@goal_period = json[:GoalPeriod]
|
27
|
+
@total_views = json[:TotalViews]
|
28
|
+
@total_supporters = json[:TotalSupporters]
|
29
|
+
@organization_id = json[:OrganizationId]
|
30
|
+
@organization_name = json[:OrganizationName]
|
31
|
+
@timezone_name = json[:TimezoneName]
|
32
|
+
@utcoffset_minutes = json[:UtcOffsetMinutes]
|
33
|
+
@time_remaining_minutes = json[:TimeRemainingMinutes]
|
34
|
+
@thumbnail_url = json[:ThumbnailUrl]
|
35
|
+
@cta_label = json[:CtaLabel]
|
36
|
+
@management_pages = json[:ManagementPages]
|
37
|
+
@primary_currency = json[:PrimaryCurrency]
|
38
|
+
@currency_symbol = json[:CurrencySymbol]
|
39
|
+
@project_id = json[:ProjectId]
|
40
|
+
@fund_code = json[:FundCode]
|
41
|
+
end
|
42
|
+
|
43
|
+
class << self
|
44
|
+
def list(
|
45
|
+
organization_id:, # required
|
46
|
+
start_date: nil, # optional
|
47
|
+
end_date: nil, # optional
|
48
|
+
sort_by: nil, # optional
|
49
|
+
campaign_type: nil, # optional
|
50
|
+
include_donation_pages: nil, # optional
|
51
|
+
status: nil # optional
|
52
|
+
)
|
53
|
+
json = RallyUp::Partner.json(:get, '/v1/partnerapi/campaigns', params: {
|
54
|
+
organizationID: organization_id,
|
55
|
+
endDate: end_date,
|
56
|
+
startDate: start_date,
|
57
|
+
sortBy: sort_by,
|
58
|
+
campaignType: campaign_type,
|
59
|
+
includeDonationPages: include_donation_pages,
|
60
|
+
status: status
|
61
|
+
}.reject { |_k, v| v.nil? })
|
62
|
+
RallyUp::ListObject.new(json, self)
|
63
|
+
end
|
64
|
+
|
65
|
+
def retrieve(id)
|
66
|
+
json = RallyUp::Partner.json(:get, "/v1/partnerapi/campaigns/#{id}")
|
67
|
+
new(json[:Result].to_h)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RallyUp
|
4
|
+
module Partner
|
5
|
+
class CampaignItem
|
6
|
+
attr_accessor :id, :campaign_id, :campaign_type, :title, :type,
|
7
|
+
:terminology_singular, :terminology_plural, :thumbnail_url,
|
8
|
+
:price, :description, :bundle_quantity,
|
9
|
+
:total_quantity_available, :total_sold,
|
10
|
+
:available_start_date, :availableend_date, :availability,
|
11
|
+
:category, :associated_prize_id, :associated_prize_title
|
12
|
+
|
13
|
+
def initialize(json)
|
14
|
+
@id = json[:Id]
|
15
|
+
@campaign_id = json[:CampaignId]
|
16
|
+
@campaign_type = json[:CampaignType]
|
17
|
+
@title = json[:Title]
|
18
|
+
@type = json[:Type]
|
19
|
+
@terminology_singular = json[:TerminologySingular]
|
20
|
+
@terminology_plural = json[:TerminologyPlural]
|
21
|
+
@thumbnail_url = json[:ThumbnailUrl]
|
22
|
+
@price = json[:Price]
|
23
|
+
@description = json[:Description]
|
24
|
+
@bundle_quantity = json[:BundleQuantity]
|
25
|
+
@total_quantity_available = json[:TotalQuantityAvailable]
|
26
|
+
@total_sold = json[:TotalSold]
|
27
|
+
@available_start_date = json[:AvailableStartDate]
|
28
|
+
@availableend_date = json[:AvailableEndDate]
|
29
|
+
@availability = json[:Availability]
|
30
|
+
@category = json[:Category]
|
31
|
+
@associated_prize_id = json[:AssociatedPrizeId]
|
32
|
+
@associated_prize_title = json[:AssociatedPrizeTitle]
|
33
|
+
end
|
34
|
+
|
35
|
+
class << self
|
36
|
+
def list(campaign_id)
|
37
|
+
json = RallyUp::Partner.json(:get, '/v1/partnerapi/campaignitems', params: {
|
38
|
+
campaignID: campaign_id
|
39
|
+
})
|
40
|
+
RallyUp::ListObject.new(json, self)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RallyUp
|
4
|
+
module Partner
|
5
|
+
class Organization
|
6
|
+
attr_accessor :id, :ein, :name, :common_name, :email, :url,
|
7
|
+
:is_tax_exempt, :address, :organization_logo_url,
|
8
|
+
:organization_website_url, :organization_facebook_url,
|
9
|
+
:organization_twitter_url, :primary_currency
|
10
|
+
|
11
|
+
def initialize(json)
|
12
|
+
@id = json[:Id]
|
13
|
+
@ein = json[:Ein]
|
14
|
+
@name = json[:Name]
|
15
|
+
@common_name = json[:CommonName]
|
16
|
+
@email = json[:Email]
|
17
|
+
@url = json[:Url]
|
18
|
+
@is_tax_exempt = json[:IsTaxExempt]
|
19
|
+
@address = json[:Address]
|
20
|
+
@organization_logo_url = json[:OrganizationLogoUrl]
|
21
|
+
@organization_website_url = json[:OrganizationWebsiteUrl]
|
22
|
+
@organization_facebook_url = json[:OrganizationFacebookUrl]
|
23
|
+
@organization_twitter_url = json[:OrganizationTwitterUrl]
|
24
|
+
@primary_currency = json[:PrimaryCurrency]
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def list(start_date: nil, end_date: nil)
|
29
|
+
json = RallyUp::Partner.json(:get, '/v1/partnerapi/organizations', params: {
|
30
|
+
endDate: end_date,
|
31
|
+
startDate: start_date
|
32
|
+
}.reject { |_k, v| v.nil? })
|
33
|
+
RallyUp::ListObject.new(json, self)
|
34
|
+
end
|
35
|
+
|
36
|
+
def retrieve(id)
|
37
|
+
json = RallyUp::Partner.json(:get, "/v1/partnerapi/organizations/#{id}")
|
38
|
+
new(json[:Result].to_h)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RallyUp
|
4
|
+
module Partner
|
5
|
+
class Token
|
6
|
+
attr_accessor :access_token, :token_type, :expires_in, :user_name,
|
7
|
+
:issued, :expires
|
8
|
+
|
9
|
+
def initialize(json)
|
10
|
+
@access_token = json[:access_token]
|
11
|
+
@token_type = json[:token_type]
|
12
|
+
@expires_in = json[:expires_in]
|
13
|
+
@user_name = json[:UserName]
|
14
|
+
@issued = json[:'.issued']
|
15
|
+
@expires = json[:'.expires']
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def retrieve(set: true)
|
20
|
+
json = RallyUp::Partner.json(:post, '/v1/partnertoken', params: {
|
21
|
+
grant_type: 'password',
|
22
|
+
username: RallyUp::Partner.login,
|
23
|
+
password: RallyUp::Partner.secret
|
24
|
+
})
|
25
|
+
token = new(json)
|
26
|
+
RallyUp::Partner.token = token.access_token if set
|
27
|
+
token
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/rally_up.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/rally_up/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rally_up'
|
7
|
+
spec.version = RallyUp::VERSION
|
8
|
+
spec.authors = ['David Richey']
|
9
|
+
spec.email = ['david.richey@memberhub.com']
|
10
|
+
|
11
|
+
spec.summary = 'RallyUp API & Partner API ruby gem'
|
12
|
+
spec.description = 'RallyUp API & Partner API ruby gem'
|
13
|
+
spec.homepage = 'https://github.com/memberhubteam/rally_up'
|
14
|
+
|
15
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
16
|
+
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/memberhubteam/rally_up'
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/memberhubteam/rally_up'
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = 'exe'
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 4.0'
|
33
|
+
|
34
|
+
spec.add_dependency 'http', '~> 4.0'
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rally_up
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Richey
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: http
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.0'
|
69
|
+
description: RallyUp API & Partner API ruby gem
|
70
|
+
email:
|
71
|
+
- david.richey@memberhub.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- lib/rally_up.rb
|
87
|
+
- lib/rally_up/list_object.rb
|
88
|
+
- lib/rally_up/partner.rb
|
89
|
+
- lib/rally_up/partner/campaign.rb
|
90
|
+
- lib/rally_up/partner/campaign_item.rb
|
91
|
+
- lib/rally_up/partner/organization.rb
|
92
|
+
- lib/rally_up/partner/token.rb
|
93
|
+
- lib/rally_up/version.rb
|
94
|
+
- rally_up.gemspec
|
95
|
+
homepage: https://github.com/memberhubteam/rally_up
|
96
|
+
licenses: []
|
97
|
+
metadata:
|
98
|
+
allowed_push_host: https://rubygems.org
|
99
|
+
homepage_uri: https://github.com/memberhubteam/rally_up
|
100
|
+
source_code_uri: https://github.com/memberhubteam/rally_up
|
101
|
+
changelog_uri: https://github.com/memberhubteam/rally_up
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubygems_version: 3.0.3
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: RallyUp API & Partner API ruby gem
|
121
|
+
test_files: []
|