Class: Files::Account
- Inherits:
-
Object
- Object
- Files::Account
- Defined in:
- lib/files.com/models/account.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.update(params = {}, options = {}) ⇒ Object
Parameters: name - string - Internal name.
Instance Method Summary collapse
-
#address ⇒ Object
string - Account address.
-
#address_2 ⇒ Object
string - Account address 2.
-
#billing_frequency ⇒ Object
int64 - Account billing frequency.
-
#card_number ⇒ Object
string - Account payment card number.
-
#card_type ⇒ Object
string - Account payment card type.
-
#city ⇒ Object
string - Account city.
-
#company_name ⇒ Object
string - Account company name.
-
#country ⇒ Object
string - Account country.
-
#created_at ⇒ Object
date-time - Account creation date/time.
-
#currency ⇒ Object
string - Account preferred currency.
-
#email ⇒ Object
email - Account email address.
-
#initialize(attributes = {}, options = {}) ⇒ Account
constructor
A new instance of Account.
-
#name ⇒ Object
string - Account name.
-
#phone_number ⇒ Object
string - Account phone number.
-
#processor_type ⇒ Object
string - Type of billing processor.
-
#state ⇒ Object
string - Account state.
-
#updated_at ⇒ Object
date-time - Account last updated at.
-
#zip ⇒ Object
string - Account zipcode.
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Account
Returns a new instance of Account.
7 8 9 10 |
# File 'lib/files.com/models/account.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/account.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/account.rb', line 5 def @options end |
Class Method Details
.update(params = {}, options = {}) ⇒ Object
Parameters:
name - string - Internal name.
company_name - string - Company name.
address - string - Address line 1.
address_2 - string - Address line 2.
city - string - City.
state - string - State.
zip - string - Zipcode.
country - string - Country.
email - string - Email.
phone_number - string - Primary phone number.
card_number - string - Credit card number.
card_type - string - Credit card type. Can be visa, master, maestro, solo, switch, american_express, or discover.
expiration_year - string - Expiration year(4 digits).
expiration_month - string - Expiration month(2 digits).
start_year - string - Required for some cards(Switch / Solo).
start_month - string - Required for some cards(Switch / Solo).
cvv - string - 3 digit code on the back of the card.
paypal_token - string - Token for paying with paypal.
paypal_payer_id - string - Paypal payer ID for paying with paypal.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/files.com/models/account.rb', line 117 def self.update(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: company_name must be an String") if params.dig(:company_name) and !params.dig(:company_name).is_a?(String) raise InvalidParameterError.new("Bad parameter: address must be an String") if params.dig(:address) and !params.dig(:address).is_a?(String) raise InvalidParameterError.new("Bad parameter: address_2 must be an String") if params.dig(:address_2) and !params.dig(:address_2).is_a?(String) raise InvalidParameterError.new("Bad parameter: city must be an String") if params.dig(:city) and !params.dig(:city).is_a?(String) raise InvalidParameterError.new("Bad parameter: state must be an String") if params.dig(:state) and !params.dig(:state).is_a?(String) raise InvalidParameterError.new("Bad parameter: zip must be an String") if params.dig(:zip) and !params.dig(:zip).is_a?(String) raise InvalidParameterError.new("Bad parameter: country must be an String") if params.dig(:country) and !params.dig(:country).is_a?(String) raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String) raise InvalidParameterError.new("Bad parameter: phone_number must be an String") if params.dig(:phone_number) and !params.dig(:phone_number).is_a?(String) raise InvalidParameterError.new("Bad parameter: card_number must be an String") if params.dig(:card_number) and !params.dig(:card_number).is_a?(String) raise InvalidParameterError.new("Bad parameter: card_type must be an String") if params.dig(:card_type) and !params.dig(:card_type).is_a?(String) raise InvalidParameterError.new("Bad parameter: expiration_year must be an String") if params.dig(:expiration_year) and !params.dig(:expiration_year).is_a?(String) raise InvalidParameterError.new("Bad parameter: expiration_month must be an String") if params.dig(:expiration_month) and !params.dig(:expiration_month).is_a?(String) raise InvalidParameterError.new("Bad parameter: start_year must be an String") if params.dig(:start_year) and !params.dig(:start_year).is_a?(String) raise InvalidParameterError.new("Bad parameter: start_month must be an String") if params.dig(:start_month) and !params.dig(:start_month).is_a?(String) raise InvalidParameterError.new("Bad parameter: cvv must be an String") if params.dig(:cvv) and !params.dig(:cvv).is_a?(String) raise InvalidParameterError.new("Bad parameter: paypal_token must be an String") if params.dig(:paypal_token) and !params.dig(:paypal_token).is_a?(String) raise InvalidParameterError.new("Bad parameter: paypal_payer_id must be an String") if params.dig(:paypal_payer_id) and !params.dig(:paypal_payer_id).is_a?(String) response, = Api.send_request("/account", :patch, params, ) Account.new(response.data, ) end |
Instance Method Details
#address ⇒ Object
string - Account address
18 19 20 |
# File 'lib/files.com/models/account.rb', line 18 def address @attributes[:address] end |
#address_2 ⇒ Object
string - Account address 2
23 24 25 |
# File 'lib/files.com/models/account.rb', line 23 def address_2 @attributes[:address_2] end |
#billing_frequency ⇒ Object
int64 - Account billing frequency. Either 12(yearly) or 1(monthly)
93 94 95 |
# File 'lib/files.com/models/account.rb', line 93 def billing_frequency @attributes[:billing_frequency] end |
#card_number ⇒ Object
string - Account payment card number
28 29 30 |
# File 'lib/files.com/models/account.rb', line 28 def card_number @attributes[:card_number] end |
#card_type ⇒ Object
string - Account payment card type
33 34 35 |
# File 'lib/files.com/models/account.rb', line 33 def card_type @attributes[:card_type] end |
#city ⇒ Object
string - Account city
38 39 40 |
# File 'lib/files.com/models/account.rb', line 38 def city @attributes[:city] end |
#company_name ⇒ Object
string - Account company name
43 44 45 |
# File 'lib/files.com/models/account.rb', line 43 def company_name @attributes[:company_name] end |
#country ⇒ Object
string - Account country
48 49 50 |
# File 'lib/files.com/models/account.rb', line 48 def country @attributes[:country] end |
#created_at ⇒ Object
date-time - Account creation date/time
53 54 55 |
# File 'lib/files.com/models/account.rb', line 53 def created_at @attributes[:created_at] end |
#currency ⇒ Object
string - Account preferred currency
58 59 60 |
# File 'lib/files.com/models/account.rb', line 58 def currency @attributes[:currency] end |
#email ⇒ Object
email - Account email address
63 64 65 |
# File 'lib/files.com/models/account.rb', line 63 def email @attributes[:email] end |
#name ⇒ Object
string - Account name
13 14 15 |
# File 'lib/files.com/models/account.rb', line 13 def name @attributes[:name] end |
#phone_number ⇒ Object
string - Account phone number
68 69 70 |
# File 'lib/files.com/models/account.rb', line 68 def phone_number @attributes[:phone_number] end |
#processor_type ⇒ Object
string - Type of billing processor. Can be PayPal, Credit Card, or Manual
73 74 75 |
# File 'lib/files.com/models/account.rb', line 73 def processor_type @attributes[:processor_type] end |
#state ⇒ Object
string - Account state
78 79 80 |
# File 'lib/files.com/models/account.rb', line 78 def state @attributes[:state] end |
#updated_at ⇒ Object
date-time - Account last updated at
83 84 85 |
# File 'lib/files.com/models/account.rb', line 83 def updated_at @attributes[:updated_at] end |
#zip ⇒ Object
string - Account zipcode
88 89 90 |
# File 'lib/files.com/models/account.rb', line 88 def zip @attributes[:zip] end |