Class: Paid::Customer
- Inherits:
-
Object
- Object
- Paid::Customer
- Defined in:
- lib/paid_ruby/types/customer.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #annual_revenue ⇒ Float readonly
- #billing_address ⇒ Paid::Address readonly
- #creation_source ⇒ Paid::CreationSource readonly
- #creation_state ⇒ Paid::CreationState readonly
- #employee_count ⇒ Float readonly
- #external_id ⇒ String readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #organization_id ⇒ String readonly
- #phone ⇒ String readonly
- #tax_exempt_status ⇒ Paid::TaxExemptStatus readonly
- #website ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, organization_id:, name:, external_id: OMIT, phone: OMIT, employee_count: OMIT, annual_revenue: OMIT, tax_exempt_status: OMIT, creation_source: OMIT, creation_state: OMIT, website: OMIT, billing_address: OMIT, additional_properties: nil) ⇒ Paid::Customer constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, organization_id:, name:, external_id: OMIT, phone: OMIT, employee_count: OMIT, annual_revenue: OMIT, tax_exempt_status: OMIT, creation_source: OMIT, creation_state: OMIT, website: OMIT, billing_address: OMIT, additional_properties: nil) ⇒ Paid::Customer
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/paid_ruby/types/customer.rb', line 57 def initialize(id:, organization_id:, name:, external_id: OMIT, phone: OMIT, employee_count: OMIT, annual_revenue: OMIT, tax_exempt_status: OMIT, creation_source: OMIT, creation_state: OMIT, website: OMIT, billing_address: OMIT, additional_properties: nil) @id = id @organization_id = organization_id @name = name @external_id = external_id if external_id != OMIT @phone = phone if phone != OMIT @employee_count = employee_count if employee_count != OMIT @annual_revenue = annual_revenue if annual_revenue != OMIT @tax_exempt_status = tax_exempt_status if tax_exempt_status != OMIT @creation_source = creation_source if creation_source != OMIT @creation_state = creation_state if creation_state != OMIT @website = website if website != OMIT @billing_address = billing_address if billing_address != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "organizationId": organization_id, "name": name, "externalId": external_id, "phone": phone, "employeeCount": employee_count, "annualRevenue": annual_revenue, "taxExemptStatus": tax_exempt_status, "creationSource": creation_source, "creationState": creation_state, "website": website, "billingAddress": billing_address }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
36 37 38 |
# File 'lib/paid_ruby/types/customer.rb', line 36 def additional_properties @additional_properties end |
#annual_revenue ⇒ Float (readonly)
24 25 26 |
# File 'lib/paid_ruby/types/customer.rb', line 24 def annual_revenue @annual_revenue end |
#billing_address ⇒ Paid::Address (readonly)
34 35 36 |
# File 'lib/paid_ruby/types/customer.rb', line 34 def billing_address @billing_address end |
#creation_source ⇒ Paid::CreationSource (readonly)
28 29 30 |
# File 'lib/paid_ruby/types/customer.rb', line 28 def creation_source @creation_source end |
#creation_state ⇒ Paid::CreationState (readonly)
30 31 32 |
# File 'lib/paid_ruby/types/customer.rb', line 30 def creation_state @creation_state end |
#employee_count ⇒ Float (readonly)
22 23 24 |
# File 'lib/paid_ruby/types/customer.rb', line 22 def employee_count @employee_count end |
#external_id ⇒ String (readonly)
18 19 20 |
# File 'lib/paid_ruby/types/customer.rb', line 18 def external_id @external_id end |
#id ⇒ String (readonly)
12 13 14 |
# File 'lib/paid_ruby/types/customer.rb', line 12 def id @id end |
#name ⇒ String (readonly)
16 17 18 |
# File 'lib/paid_ruby/types/customer.rb', line 16 def name @name end |
#organization_id ⇒ String (readonly)
14 15 16 |
# File 'lib/paid_ruby/types/customer.rb', line 14 def organization_id @organization_id end |
#phone ⇒ String (readonly)
20 21 22 |
# File 'lib/paid_ruby/types/customer.rb', line 20 def phone @phone end |
#tax_exempt_status ⇒ Paid::TaxExemptStatus (readonly)
26 27 28 |
# File 'lib/paid_ruby/types/customer.rb', line 26 def tax_exempt_status @tax_exempt_status end |
#website ⇒ String (readonly)
32 33 34 |
# File 'lib/paid_ruby/types/customer.rb', line 32 def website @website end |
Class Method Details
.from_json(json_object:) ⇒ Paid::Customer
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/paid_ruby/types/customer.rb', line 79 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] organization_id = parsed_json["organizationId"] name = parsed_json["name"] external_id = parsed_json["externalId"] phone = parsed_json["phone"] employee_count = parsed_json["employeeCount"] annual_revenue = parsed_json["annualRevenue"] tax_exempt_status = parsed_json["taxExemptStatus"] creation_source = parsed_json["creationSource"] creation_state = parsed_json["creationState"] website = parsed_json["website"] unless parsed_json["billingAddress"].nil? billing_address = parsed_json["billingAddress"].to_json billing_address = Paid::Address.from_json(json_object: billing_address) else billing_address = nil end new( id: id, organization_id: organization_id, name: name, external_id: external_id, phone: phone, employee_count: employee_count, annual_revenue: annual_revenue, tax_exempt_status: tax_exempt_status, creation_source: creation_source, creation_state: creation_state, website: website, billing_address: billing_address, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/paid_ruby/types/customer.rb', line 127 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_id is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.") obj.phone&.is_a?(String) != false || raise("Passed value for field obj.phone is not the expected type, validation failed.") obj.employee_count&.is_a?(Float) != false || raise("Passed value for field obj.employee_count is not the expected type, validation failed.") obj.annual_revenue&.is_a?(Float) != false || raise("Passed value for field obj.annual_revenue is not the expected type, validation failed.") obj.tax_exempt_status&.is_a?(Paid::TaxExemptStatus) != false || raise("Passed value for field obj.tax_exempt_status is not the expected type, validation failed.") obj.creation_source&.is_a?(Paid::CreationSource) != false || raise("Passed value for field obj.creation_source is not the expected type, validation failed.") obj.creation_state&.is_a?(Paid::CreationState) != false || raise("Passed value for field obj.creation_state is not the expected type, validation failed.") obj.website&.is_a?(String) != false || raise("Passed value for field obj.website is not the expected type, validation failed.") obj.billing_address.nil? || Paid::Address.validate_raw(obj: obj.billing_address) end |
Instance Method Details
#to_json ⇒ String
118 119 120 |
# File 'lib/paid_ruby/types/customer.rb', line 118 def to_json @_field_set&.to_json end |