Class: RallyUp::Partner::Organization
- Inherits:
-
Object
- Object
- RallyUp::Partner::Organization
- Defined in:
- lib/rally_up/partner/organization.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#common_name ⇒ Object
Returns the value of attribute common_name.
-
#ein ⇒ Object
Returns the value of attribute ein.
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_tax_exempt ⇒ Object
Returns the value of attribute is_tax_exempt.
-
#name ⇒ Object
Returns the value of attribute name.
-
#organization_facebook_url ⇒ Object
Returns the value of attribute organization_facebook_url.
-
#organization_logo_url ⇒ Object
Returns the value of attribute organization_logo_url.
-
#organization_twitter_url ⇒ Object
Returns the value of attribute organization_twitter_url.
-
#organization_website_url ⇒ Object
Returns the value of attribute organization_website_url.
-
#primary_currency ⇒ Object
Returns the value of attribute primary_currency.
-
#status ⇒ Object
Returns the value of attribute status.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
- .approve(id) ⇒ Object
- .create(attrs = {}) ⇒ Object
- .delete(id) ⇒ Object
- .list(start_date: nil, end_date: nil) ⇒ Object
- .retrieve(id) ⇒ Object
- .set_on_behalf_of(id:, on_behalf_of:) ⇒ Object
Instance Method Summary collapse
-
#initialize(json) ⇒ Organization
constructor
A new instance of Organization.
Constructor Details
#initialize(json) ⇒ Organization
Returns a new instance of Organization.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rally_up/partner/organization.rb', line 11 def initialize(json) @id = json[:Id] @ein = json[:Ein] @name = json[:Name] @common_name = json[:CommonName] @email = json[:Email] @url = json[:Url] @is_tax_exempt = json[:IsTaxExempt] @address = json[:Address] @organization_logo_url = json[:OrganizationLogoUrl] @organization_website_url = json[:OrganizationWebsiteUrl] @organization_facebook_url = json[:OrganizationFacebookUrl] @organization_twitter_url = json[:OrganizationTwitterUrl] @primary_currency = json[:PrimaryCurrency] @status = json[:Status] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def address @address end |
#common_name ⇒ Object
Returns the value of attribute common_name.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def common_name @common_name end |
#ein ⇒ Object
Returns the value of attribute ein.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def ein @ein end |
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def id @id end |
#is_tax_exempt ⇒ Object
Returns the value of attribute is_tax_exempt.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def is_tax_exempt @is_tax_exempt end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def name @name end |
#organization_facebook_url ⇒ Object
Returns the value of attribute organization_facebook_url.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def organization_facebook_url @organization_facebook_url end |
#organization_logo_url ⇒ Object
Returns the value of attribute organization_logo_url.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def organization_logo_url @organization_logo_url end |
#organization_twitter_url ⇒ Object
Returns the value of attribute organization_twitter_url.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def organization_twitter_url @organization_twitter_url end |
#organization_website_url ⇒ Object
Returns the value of attribute organization_website_url.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def organization_website_url @organization_website_url end |
#primary_currency ⇒ Object
Returns the value of attribute primary_currency.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def primary_currency @primary_currency end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def status @status end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/rally_up/partner/organization.rb', line 6 def url @url end |
Class Method Details
.approve(id) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/rally_up/partner/organization.rb', line 29 def approve(id) RallyUp::Partner.request(:post, '/v1/partnerapi/approvecustomorg', params: { OrganizationID: id }) new(Id: id) end |
.create(attrs = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rally_up/partner/organization.rb', line 36 def create(attrs = {}) json = RallyUp::Partner.json(:post, '/v1/partnerapi/addcustomorg', params: { :Name => attrs[:name], :Country => attrs[:country], :Address1 => attrs[:address1], :Address2 => attrs[:address2], :Address3 => attrs[:address3], :State => attrs[:state], :City => attrs[:city], :PostalCode => attrs[:postal_code], '501c' => attrs['501c'], :EIN => attrs[:ein] }.reject { |_k, v| v.nil? }) new(json[:Result].to_h) end |
.delete(id) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/rally_up/partner/organization.rb', line 52 def delete(id) json = RallyUp::Partner.json(:delete, '/v1/partnerapi/deletecustomorg', params: { OrganizationID: id }) new(json[:Result].to_h) end |
.list(start_date: nil, end_date: nil) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/rally_up/partner/organization.rb', line 59 def list(start_date: nil, end_date: nil) json = RallyUp::Partner.json(:get, '/v1/partnerapi/organizations', params: { endDate: end_date, startDate: start_date }.reject { |_k, v| v.nil? }) RallyUp::ListObject.new(json, self) end |
.retrieve(id) ⇒ Object
67 68 69 70 |
# File 'lib/rally_up/partner/organization.rb', line 67 def retrieve(id) json = RallyUp::Partner.json(:get, "/v1/partnerapi/organizations/#{id}") new(json[:Result].to_h) end |
.set_on_behalf_of(id:, on_behalf_of:) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/rally_up/partner/organization.rb', line 72 def set_on_behalf_of(id:, on_behalf_of:) RallyUp::Partner.request(:post, '/v1/partnerapi/setonbehalfaccount', params: { OrganizationId: id, StripeOnBehalfAccountId: on_behalf_of }) new(Id: id) end |