Class: Paid::Order
- Inherits:
-
Object
- Object
- Paid::Order
- Defined in:
- lib/paid_ruby/types/order.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #billed_amount_no_tax ⇒ Float readonly
- #billed_tax ⇒ Float readonly
- #creation_state ⇒ Paid::CreationState readonly
- #customer ⇒ Paid::Customer readonly
- #customer_id ⇒ String readonly
- #description ⇒ String readonly
- #end_date ⇒ String readonly
- #estimated_tax ⇒ Float readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #order_lines ⇒ Array<Paid::OrderLine> readonly
- #organization_id ⇒ String readonly
- #pending_billing_amount ⇒ Float readonly
- #start_date ⇒ String readonly
- #total_amount ⇒ Float readonly
- #total_billed_amount ⇒ Float readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id: OMIT, name: OMIT, description: OMIT, customer_id: OMIT, organization_id: OMIT, start_date: OMIT, end_date: OMIT, total_amount: OMIT, estimated_tax: OMIT, billed_amount_no_tax: OMIT, billed_tax: OMIT, total_billed_amount: OMIT, pending_billing_amount: OMIT, creation_state: OMIT, order_lines: OMIT, customer: OMIT, additional_properties: nil) ⇒ Paid::Order constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, name: OMIT, description: OMIT, customer_id: OMIT, organization_id: OMIT, start_date: OMIT, end_date: OMIT, total_amount: OMIT, estimated_tax: OMIT, billed_amount_no_tax: OMIT, billed_tax: OMIT, total_billed_amount: OMIT, pending_billing_amount: OMIT, creation_state: OMIT, order_lines: OMIT, customer: OMIT, additional_properties: nil) ⇒ Paid::Order
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/paid_ruby/types/order.rb', line 68 def initialize(id: OMIT, name: OMIT, description: OMIT, customer_id: OMIT, organization_id: OMIT, start_date: OMIT, end_date: OMIT, total_amount: OMIT, estimated_tax: OMIT, billed_amount_no_tax: OMIT, billed_tax: OMIT, total_billed_amount: OMIT, pending_billing_amount: OMIT, creation_state: OMIT, order_lines: OMIT, customer: OMIT, additional_properties: nil) @id = id if id != OMIT @name = name if name != OMIT @description = description if description != OMIT @customer_id = customer_id if customer_id != OMIT @organization_id = organization_id if organization_id != OMIT @start_date = start_date if start_date != OMIT @end_date = end_date if end_date != OMIT @total_amount = total_amount if total_amount != OMIT @estimated_tax = estimated_tax if estimated_tax != OMIT @billed_amount_no_tax = billed_amount_no_tax if billed_amount_no_tax != OMIT @billed_tax = billed_tax if billed_tax != OMIT @total_billed_amount = total_billed_amount if total_billed_amount != OMIT @pending_billing_amount = pending_billing_amount if pending_billing_amount != OMIT @creation_state = creation_state if creation_state != OMIT @order_lines = order_lines if order_lines != OMIT @customer = customer if customer != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "description": description, "customerId": customer_id, "organizationId": organization_id, "startDate": start_date, "endDate": end_date, "totalAmount": total_amount, "estimatedTax": estimated_tax, "billedAmountNoTax": billed_amount_no_tax, "billedTax": billed_tax, "totalBilledAmount": total_billed_amount, "pendingBillingAmount": pending_billing_amount, "creationState": creation_state, "orderLines": order_lines, "customer": customer }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
43 44 45 |
# File 'lib/paid_ruby/types/order.rb', line 43 def additional_properties @additional_properties end |
#billed_amount_no_tax ⇒ Float (readonly)
29 30 31 |
# File 'lib/paid_ruby/types/order.rb', line 29 def billed_amount_no_tax @billed_amount_no_tax end |
#billed_tax ⇒ Float (readonly)
31 32 33 |
# File 'lib/paid_ruby/types/order.rb', line 31 def billed_tax @billed_tax end |
#creation_state ⇒ Paid::CreationState (readonly)
37 38 39 |
# File 'lib/paid_ruby/types/order.rb', line 37 def creation_state @creation_state end |
#customer ⇒ Paid::Customer (readonly)
41 42 43 |
# File 'lib/paid_ruby/types/order.rb', line 41 def customer @customer end |
#customer_id ⇒ String (readonly)
17 18 19 |
# File 'lib/paid_ruby/types/order.rb', line 17 def customer_id @customer_id end |
#description ⇒ String (readonly)
15 16 17 |
# File 'lib/paid_ruby/types/order.rb', line 15 def description @description end |
#end_date ⇒ String (readonly)
23 24 25 |
# File 'lib/paid_ruby/types/order.rb', line 23 def end_date @end_date end |
#estimated_tax ⇒ Float (readonly)
27 28 29 |
# File 'lib/paid_ruby/types/order.rb', line 27 def estimated_tax @estimated_tax end |
#id ⇒ String (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/order.rb', line 11 def id @id end |
#name ⇒ String (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/order.rb', line 13 def name @name end |
#order_lines ⇒ Array<Paid::OrderLine> (readonly)
39 40 41 |
# File 'lib/paid_ruby/types/order.rb', line 39 def order_lines @order_lines end |
#organization_id ⇒ String (readonly)
19 20 21 |
# File 'lib/paid_ruby/types/order.rb', line 19 def organization_id @organization_id end |
#pending_billing_amount ⇒ Float (readonly)
35 36 37 |
# File 'lib/paid_ruby/types/order.rb', line 35 def pending_billing_amount @pending_billing_amount end |
#start_date ⇒ String (readonly)
21 22 23 |
# File 'lib/paid_ruby/types/order.rb', line 21 def start_date @start_date end |
#total_amount ⇒ Float (readonly)
25 26 27 |
# File 'lib/paid_ruby/types/order.rb', line 25 def total_amount @total_amount end |
#total_billed_amount ⇒ Float (readonly)
33 34 35 |
# File 'lib/paid_ruby/types/order.rb', line 33 def total_billed_amount @total_billed_amount end |
Class Method Details
.from_json(json_object:) ⇒ Paid::Order
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 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/paid_ruby/types/order.rb', line 94 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] name = parsed_json["name"] description = parsed_json["description"] customer_id = parsed_json["customerId"] organization_id = parsed_json["organizationId"] start_date = parsed_json["startDate"] end_date = parsed_json["endDate"] total_amount = parsed_json["totalAmount"] estimated_tax = parsed_json["estimatedTax"] billed_amount_no_tax = parsed_json["billedAmountNoTax"] billed_tax = parsed_json["billedTax"] total_billed_amount = parsed_json["totalBilledAmount"] pending_billing_amount = parsed_json["pendingBillingAmount"] creation_state = parsed_json["creationState"] order_lines = parsed_json["orderLines"]&.map do | item | item = item.to_json Paid::OrderLine.from_json(json_object: item) end unless parsed_json["customer"].nil? customer = parsed_json["customer"].to_json customer = Paid::Customer.from_json(json_object: customer) else customer = nil end new( id: id, name: name, description: description, customer_id: customer_id, organization_id: organization_id, start_date: start_date, end_date: end_date, total_amount: total_amount, estimated_tax: estimated_tax, billed_amount_no_tax: billed_amount_no_tax, billed_tax: billed_tax, total_billed_amount: total_billed_amount, pending_billing_amount: pending_billing_amount, creation_state: creation_state, order_lines: order_lines, customer: customer, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/paid_ruby/types/order.rb', line 153 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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_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.start_date&.is_a?(String) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.") obj.end_date&.is_a?(String) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.") obj.total_amount&.is_a?(Float) != false || raise("Passed value for field obj.total_amount is not the expected type, validation failed.") obj.estimated_tax&.is_a?(Float) != false || raise("Passed value for field obj.estimated_tax is not the expected type, validation failed.") obj.billed_amount_no_tax&.is_a?(Float) != false || raise("Passed value for field obj.billed_amount_no_tax is not the expected type, validation failed.") obj.billed_tax&.is_a?(Float) != false || raise("Passed value for field obj.billed_tax is not the expected type, validation failed.") obj.total_billed_amount&.is_a?(Float) != false || raise("Passed value for field obj.total_billed_amount is not the expected type, validation failed.") obj.pending_billing_amount&.is_a?(Float) != false || raise("Passed value for field obj.pending_billing_amount 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.order_lines&.is_a?(Array) != false || raise("Passed value for field obj.order_lines is not the expected type, validation failed.") obj.customer.nil? || Paid::Customer.validate_raw(obj: obj.customer) end |
Instance Method Details
#to_json ⇒ String
144 145 146 |
# File 'lib/paid_ruby/types/order.rb', line 144 def to_json @_field_set&.to_json end |