Class: Paid::OrderLine
- Inherits:
-
Object
- Object
- Paid::OrderLine
- Defined in:
- lib/paid_ruby/types/order_line.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #agent ⇒ Paid::Agent readonly
- #agent_id ⇒ String readonly
- #billed_amount_without_tax ⇒ Float readonly
- #billed_tax ⇒ Float readonly
- #creation_state ⇒ Paid::CreationState readonly
- #description ⇒ String readonly
- #end_date ⇒ String readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #order_id ⇒ String readonly
- #order_line_attributes ⇒ Array<Paid::OrderLineAttribute> 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, order_id: OMIT, agent_id: OMIT, name: OMIT, description: OMIT, start_date: OMIT, end_date: OMIT, total_amount: OMIT, billed_amount_without_tax: OMIT, billed_tax: OMIT, total_billed_amount: OMIT, creation_state: OMIT, agent: OMIT, order_line_attributes: OMIT, additional_properties: nil) ⇒ Paid::OrderLine constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, order_id: OMIT, agent_id: OMIT, name: OMIT, description: OMIT, start_date: OMIT, end_date: OMIT, total_amount: OMIT, billed_amount_without_tax: OMIT, billed_tax: OMIT, total_billed_amount: OMIT, creation_state: OMIT, agent: OMIT, order_line_attributes: OMIT, additional_properties: nil) ⇒ Paid::OrderLine
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/paid_ruby/types/order_line.rb', line 62 def initialize(id: OMIT, order_id: OMIT, agent_id: OMIT, name: OMIT, description: OMIT, start_date: OMIT, end_date: OMIT, total_amount: OMIT, billed_amount_without_tax: OMIT, billed_tax: OMIT, total_billed_amount: OMIT, creation_state: OMIT, agent: OMIT, order_line_attributes: OMIT, additional_properties: nil) @id = id if id != OMIT @order_id = order_id if order_id != OMIT @agent_id = agent_id if agent_id != OMIT @name = name if name != OMIT @description = description if description != 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 @billed_amount_without_tax = billed_amount_without_tax if billed_amount_without_tax != OMIT @billed_tax = billed_tax if billed_tax != OMIT @total_billed_amount = total_billed_amount if total_billed_amount != OMIT @creation_state = creation_state if creation_state != OMIT @agent = agent if agent != OMIT @order_line_attributes = order_line_attributes if order_line_attributes != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "orderId": order_id, "agentId": agent_id, "name": name, "description": description, "startDate": start_date, "endDate": end_date, "totalAmount": total_amount, "billedAmountWithoutTax": billed_amount_without_tax, "billedTax": billed_tax, "totalBilledAmount": total_billed_amount, "creationState": creation_state, "agent": agent, "orderLineAttributes": order_line_attributes }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
39 40 41 |
# File 'lib/paid_ruby/types/order_line.rb', line 39 def additional_properties @additional_properties end |
#agent ⇒ Paid::Agent (readonly)
35 36 37 |
# File 'lib/paid_ruby/types/order_line.rb', line 35 def agent @agent end |
#agent_id ⇒ String (readonly)
15 16 17 |
# File 'lib/paid_ruby/types/order_line.rb', line 15 def agent_id @agent_id end |
#billed_amount_without_tax ⇒ Float (readonly)
27 28 29 |
# File 'lib/paid_ruby/types/order_line.rb', line 27 def billed_amount_without_tax @billed_amount_without_tax end |
#billed_tax ⇒ Float (readonly)
29 30 31 |
# File 'lib/paid_ruby/types/order_line.rb', line 29 def billed_tax @billed_tax end |
#creation_state ⇒ Paid::CreationState (readonly)
33 34 35 |
# File 'lib/paid_ruby/types/order_line.rb', line 33 def creation_state @creation_state end |
#description ⇒ String (readonly)
19 20 21 |
# File 'lib/paid_ruby/types/order_line.rb', line 19 def description @description end |
#end_date ⇒ String (readonly)
23 24 25 |
# File 'lib/paid_ruby/types/order_line.rb', line 23 def end_date @end_date end |
#id ⇒ String (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/order_line.rb', line 11 def id @id end |
#name ⇒ String (readonly)
17 18 19 |
# File 'lib/paid_ruby/types/order_line.rb', line 17 def name @name end |
#order_id ⇒ String (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/order_line.rb', line 13 def order_id @order_id end |
#order_line_attributes ⇒ Array<Paid::OrderLineAttribute> (readonly)
37 38 39 |
# File 'lib/paid_ruby/types/order_line.rb', line 37 def order_line_attributes @order_line_attributes end |
#start_date ⇒ String (readonly)
21 22 23 |
# File 'lib/paid_ruby/types/order_line.rb', line 21 def start_date @start_date end |
#total_amount ⇒ Float (readonly)
25 26 27 |
# File 'lib/paid_ruby/types/order_line.rb', line 25 def total_amount @total_amount end |
#total_billed_amount ⇒ Float (readonly)
31 32 33 |
# File 'lib/paid_ruby/types/order_line.rb', line 31 def total_billed_amount @total_billed_amount end |
Class Method Details
.from_json(json_object:) ⇒ Paid::OrderLine
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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/paid_ruby/types/order_line.rb', line 86 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] order_id = parsed_json["orderId"] agent_id = parsed_json["agentId"] name = parsed_json["name"] description = parsed_json["description"] start_date = parsed_json["startDate"] end_date = parsed_json["endDate"] total_amount = parsed_json["totalAmount"] billed_amount_without_tax = parsed_json["billedAmountWithoutTax"] billed_tax = parsed_json["billedTax"] total_billed_amount = parsed_json["totalBilledAmount"] creation_state = parsed_json["creationState"] unless parsed_json["agent"].nil? agent = parsed_json["agent"].to_json agent = Paid::Agent.from_json(json_object: agent) else agent = nil end order_line_attributes = parsed_json["orderLineAttributes"]&.map do | item | item = item.to_json Paid::OrderLineAttribute.from_json(json_object: item) end new( id: id, order_id: order_id, agent_id: agent_id, name: name, description: description, start_date: start_date, end_date: end_date, total_amount: total_amount, billed_amount_without_tax: billed_amount_without_tax, billed_tax: billed_tax, total_billed_amount: total_billed_amount, creation_state: creation_state, agent: agent, order_line_attributes: order_line_attributes, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/paid_ruby/types/order_line.rb', line 141 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.order_id&.is_a?(String) != false || raise("Passed value for field obj.order_id is not the expected type, validation failed.") obj.agent_id&.is_a?(String) != false || raise("Passed value for field obj.agent_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.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.billed_amount_without_tax&.is_a?(Float) != false || raise("Passed value for field obj.billed_amount_without_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.creation_state&.is_a?(Paid::CreationState) != false || raise("Passed value for field obj.creation_state is not the expected type, validation failed.") obj.agent.nil? || Paid::Agent.validate_raw(obj: obj.agent) obj.order_line_attributes&.is_a?(Array) != false || raise("Passed value for field obj.order_line_attributes is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
132 133 134 |
# File 'lib/paid_ruby/types/order_line.rb', line 132 def to_json @_field_set&.to_json end |