Class: Paid::CustomerUpdate
- Inherits:
-
Object
- Object
- Paid::CustomerUpdate
- Defined in:
- lib/paid_ruby/types/customer_update.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
- #employee_count ⇒ Float readonly
- #external_id ⇒ String readonly
- #name ⇒ String readonly
- #phone ⇒ String readonly
- #tax_exempt_status ⇒ Paid::TaxExemptStatus readonly
- #website ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(name: OMIT, external_id: OMIT, phone: OMIT, employee_count: OMIT, annual_revenue: OMIT, tax_exempt_status: OMIT, creation_source: OMIT, website: OMIT, billing_address: OMIT, additional_properties: nil) ⇒ Paid::CustomerUpdate constructor
- #to_json ⇒ String
Constructor Details
#initialize(name: OMIT, external_id: OMIT, phone: OMIT, employee_count: OMIT, annual_revenue: OMIT, tax_exempt_status: OMIT, creation_source: OMIT, website: OMIT, billing_address: OMIT, additional_properties: nil) ⇒ Paid::CustomerUpdate
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/paid_ruby/types/customer_update.rb', line 47 def initialize(name: OMIT, external_id: OMIT, phone: OMIT, employee_count: OMIT, annual_revenue: OMIT, tax_exempt_status: OMIT, creation_source: OMIT, website: OMIT, billing_address: OMIT, additional_properties: nil) @name = name if name != OMIT @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 @website = website if website != OMIT @billing_address = billing_address if billing_address != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "externalId": external_id, "phone": phone, "employeeCount": employee_count, "annualRevenue": annual_revenue, "taxExemptStatus": tax_exempt_status, "creationSource": creation_source, "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.
29 30 31 |
# File 'lib/paid_ruby/types/customer_update.rb', line 29 def additional_properties @additional_properties end |
#annual_revenue ⇒ Float (readonly)
19 20 21 |
# File 'lib/paid_ruby/types/customer_update.rb', line 19 def annual_revenue @annual_revenue end |
#billing_address ⇒ Paid::Address (readonly)
27 28 29 |
# File 'lib/paid_ruby/types/customer_update.rb', line 27 def billing_address @billing_address end |
#creation_source ⇒ Paid::CreationSource (readonly)
23 24 25 |
# File 'lib/paid_ruby/types/customer_update.rb', line 23 def creation_source @creation_source end |
#employee_count ⇒ Float (readonly)
17 18 19 |
# File 'lib/paid_ruby/types/customer_update.rb', line 17 def employee_count @employee_count end |
#external_id ⇒ String (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/customer_update.rb', line 13 def external_id @external_id end |
#name ⇒ String (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/customer_update.rb', line 11 def name @name end |
#phone ⇒ String (readonly)
15 16 17 |
# File 'lib/paid_ruby/types/customer_update.rb', line 15 def phone @phone end |
#tax_exempt_status ⇒ Paid::TaxExemptStatus (readonly)
21 22 23 |
# File 'lib/paid_ruby/types/customer_update.rb', line 21 def tax_exempt_status @tax_exempt_status end |
#website ⇒ String (readonly)
25 26 27 |
# File 'lib/paid_ruby/types/customer_update.rb', line 25 def website @website end |
Class Method Details
.from_json(json_object:) ⇒ Paid::CustomerUpdate
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/paid_ruby/types/customer_update.rb', line 66 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) 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"] 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( 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, website: website, billing_address: billing_address, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/paid_ruby/types/customer_update.rb', line 108 def self.validate_raw(obj:) 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.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
99 100 101 |
# File 'lib/paid_ruby/types/customer_update.rb', line 99 def to_json @_field_set&.to_json end |