rally_up 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2bd64acb8f9af4b14ca1914980d050fbf2d54dbb778c53be9da3ad0275d97a5
4
- data.tar.gz: cc97a5baa89a8447121f8aab2616f702adb7dbe2ce2f455403eb29403ea37523
3
+ metadata.gz: d974f1c002a3da939765394bec66b17a5789caa7095eaf654ee3c2faa583fcae
4
+ data.tar.gz: 7685bddc6c797e99d2c31d1ee623c1234dda1face7bd09a71072fbe34b3431bb
5
5
  SHA512:
6
- metadata.gz: 8c450d30ba3e7fedd22f8cfa29fc644038675a8355f580f4bb2f43d968d4b53cb00c483c8be09db4a66ff6d92967bebabdb55bdb58918f23e9d9c9cbb0a2e9bf
7
- data.tar.gz: 53974266d61f735f684117ea2620d90d00c2cfc57b674ffb96ae262dc2f6d31588c4dd3f0a7ddd2f37e9ca58cb663521440b7cb7984e43ae1b5f6a88bd4aad6d
6
+ metadata.gz: 66f5a4feb0846fb8b5787ad9cb265ac15c0126412dc4fa8be00b1dba6ceb0e1b21bb303f9e60de1d0c9b5474852761a370f837b7a51f87f02c310f1c55c60b1b
7
+ data.tar.gz: cd7742fddb03fffc8f02a824ff778ed74915a64e55bfa04446b3608a4de590bac2f06934852ff07290fcb84df4cc960e881978df8f32d95a422a070bef797dae
data/Gemfile.lock CHANGED
@@ -1,20 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rally_up (1.0.0)
4
+ rally_up (1.0.1)
5
5
  http (~> 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.7.0)
10
+ addressable (2.8.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
12
  coderay (1.1.3)
13
- crack (0.4.4)
13
+ crack (0.4.5)
14
+ rexml
14
15
  diff-lcs (1.4.4)
15
16
  domain_name (0.5.20190701)
16
17
  unf (>= 0.0.5, < 1.0.0)
17
- ffi (1.13.1)
18
+ ffi (1.15.4)
18
19
  ffi-compiler (1.0.1)
19
20
  ffi (>= 1.0.0)
20
21
  rake
@@ -24,35 +25,36 @@ GEM
24
25
  http-cookie (~> 1.0)
25
26
  http-form_data (~> 2.2)
26
27
  http-parser (~> 1.2.0)
27
- http-cookie (1.0.3)
28
+ http-cookie (1.0.4)
28
29
  domain_name (~> 0.5)
29
30
  http-form_data (2.3.0)
30
- http-parser (1.2.2)
31
- ffi-compiler
31
+ http-parser (1.2.3)
32
+ ffi-compiler (>= 1.0, < 2.0)
32
33
  method_source (1.0.0)
33
- pry (0.13.1)
34
+ pry (0.14.1)
34
35
  coderay (~> 1.1)
35
36
  method_source (~> 1.0)
36
37
  public_suffix (4.0.6)
37
38
  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)
39
+ rexml (3.2.5)
40
+ rspec (3.10.0)
41
+ rspec-core (~> 3.10.0)
42
+ rspec-expectations (~> 3.10.0)
43
+ rspec-mocks (~> 3.10.0)
44
+ rspec-core (3.10.1)
45
+ rspec-support (~> 3.10.0)
46
+ rspec-expectations (3.10.1)
45
47
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.9.0)
47
- rspec-mocks (3.9.1)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-mocks (3.10.2)
48
50
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.9.0)
50
- rspec-support (3.9.3)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-support (3.10.2)
51
53
  unf (0.1.4)
52
54
  unf_ext
53
- unf_ext (0.0.7.7)
54
- webmock (3.9.2)
55
- addressable (>= 2.3.6)
55
+ unf_ext (0.0.8)
56
+ webmock (3.14.0)
57
+ addressable (>= 2.8.0)
56
58
  crack (>= 0.3.2)
57
59
  hashdiff (>= 0.4.0, < 2.0.0)
58
60
 
@@ -68,4 +70,4 @@ DEPENDENCIES
68
70
  webmock
69
71
 
70
72
  BUNDLED WITH
71
- 2.1.4
73
+ 2.2.26
@@ -6,7 +6,7 @@ module RallyUp
6
6
  attr_accessor :id, :ein, :name, :common_name, :email, :url,
7
7
  :is_tax_exempt, :address, :organization_logo_url,
8
8
  :organization_website_url, :organization_facebook_url,
9
- :organization_twitter_url, :primary_currency
9
+ :organization_twitter_url, :primary_currency, :status
10
10
 
11
11
  def initialize(json)
12
12
  @id = json[:Id]
@@ -22,9 +22,40 @@ module RallyUp
22
22
  @organization_facebook_url = json[:OrganizationFacebookUrl]
23
23
  @organization_twitter_url = json[:OrganizationTwitterUrl]
24
24
  @primary_currency = json[:PrimaryCurrency]
25
+ @status = json[:Status]
25
26
  end
26
27
 
27
28
  class << self
29
+ def approve(id)
30
+ RallyUp::Partner.request(:post, '/v1/partnerapi/approvecustomorg', params: {
31
+ OrganizationID: id
32
+ })
33
+ new(Id: id)
34
+ end
35
+
36
+ def create(attrs = {})
37
+ json = RallyUp::Partner.json(:post, '/v1/partnerapi/addcustomorg', params: {
38
+ :Name => attrs[:name],
39
+ :Country => attrs[:country],
40
+ :Address1 => attrs[:address1],
41
+ :Address2 => attrs[:address2],
42
+ :Address3 => attrs[:address3],
43
+ :State => attrs[:state],
44
+ :City => attrs[:city],
45
+ :PostalCode => attrs[:postal_code],
46
+ '501c' => attrs['501c'],
47
+ :EIN => attrs[:ein]
48
+ }.reject { |_k, v| v.nil? })
49
+ new(json[:Result].to_h)
50
+ end
51
+
52
+ def delete(id)
53
+ json = RallyUp::Partner.json(:delete, '/v1/partnerapi/deletecustomorg', params: {
54
+ OrganizationID: id
55
+ })
56
+ new(json[:Result].to_h)
57
+ end
58
+
28
59
  def list(start_date: nil, end_date: nil)
29
60
  json = RallyUp::Partner.json(:get, '/v1/partnerapi/organizations', params: {
30
61
  endDate: end_date,
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RallyUp
4
+ module Partner
5
+ class User
6
+ attr_accessor :id, :first_name, :last_name, :email, :role, :created_date, :added_date,
7
+ :organization_id
8
+
9
+ def initialize(json)
10
+ @id = json[:UserID]
11
+ @organization_id = json[:OrganizationID]
12
+ @first_name = json[:FirstName]
13
+ @last_name = json[:LastName]
14
+ @email = json[:Email]
15
+ @role = json[:Role]
16
+ @created_date = json[:CreatedDate]
17
+ @added_date = json[:AddedDate]
18
+ end
19
+
20
+ class << self
21
+ def create(organization_id, email, role = 'Administrator')
22
+ json = RallyUp::Partner.json(:post, '/v1/partnerapi/addorguser', params: {
23
+ OrganizationID: organization_id,
24
+ Email: email,
25
+ Role: role
26
+ })
27
+ new(json[:Result].to_h)
28
+ end
29
+
30
+ def delete(organization_id, email)
31
+ json = RallyUp::Partner.json(:delete, '/v1/partnerapi/deleteorguser', params: {
32
+ OrganizationID: organization_id,
33
+ Email: email
34
+ })
35
+ new(json[:Result].to_h)
36
+ end
37
+
38
+ def list(organization_id)
39
+ json = RallyUp::Partner.json(:get, "/v1/partnerapi/listorgusers?OrganizationID=#{organization_id}")
40
+ RallyUp::ListObject.new(json, self)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -15,7 +15,10 @@ module RallyUp
15
15
  path,
16
16
  domain: domain,
17
17
  params: params,
18
- headers: headers.merge('Authorization' => "Bearer #{RallyUp::Partner.token}")
18
+ headers: headers.merge(
19
+ 'Authorization' => "Bearer #{RallyUp::Partner.token}",
20
+ 'Content-Type' => 'application/x-www-form-urlencoded'
21
+ )
19
22
  )
20
23
  end
21
24
  end
@@ -26,3 +29,4 @@ require 'rally_up/partner/token'
26
29
  require 'rally_up/partner/campaign'
27
30
  require 'rally_up/partner/campaign_item'
28
31
  require 'rally_up/partner/organization'
32
+ require 'rally_up/partner/user'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RallyUp
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
data/lib/rally_up.rb CHANGED
@@ -52,6 +52,7 @@ module RallyUp
52
52
 
53
53
  class Error < StandardError
54
54
  attr_accessor :code, :body
55
+
55
56
  def initialize(response)
56
57
  @body = response.body
57
58
  @code = response.code
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rally_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Richey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,6 +90,7 @@ files:
90
90
  - lib/rally_up/partner/campaign_item.rb
91
91
  - lib/rally_up/partner/organization.rb
92
92
  - lib/rally_up/partner/token.rb
93
+ - lib/rally_up/partner/user.rb
93
94
  - lib/rally_up/version.rb
94
95
  - rally_up.gemspec
95
96
  homepage: https://github.com/memberhubteam/rally_up