Class: CDEKApiClient::Entities::OrderData
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::OrderData
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/order_data.rb
Overview
Represents the data required to create an order in the CDEK API. Each order includes attributes such as type, number, tariff code, locations, recipient, sender, and packages.
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#delivery_point ⇒ Object
Returns the value of attribute delivery_point.
-
#from_location ⇒ Object
Returns the value of attribute from_location.
-
#number ⇒ Object
Returns the value of attribute number.
-
#packages ⇒ Object
Returns the value of attribute packages.
-
#recipient ⇒ Object
Returns the value of attribute recipient.
-
#sender ⇒ Object
Returns the value of attribute sender.
-
#services ⇒ Object
Returns the value of attribute services.
-
#shipment_point ⇒ Object
Returns the value of attribute shipment_point.
-
#tariff_code ⇒ Object
Returns the value of attribute tariff_code.
-
#to_location ⇒ Object
Returns the value of attribute to_location.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, number:, tariff_code:, from_location:, to_location:, recipient:, sender:, packages:, comment: nil, shipment_point: nil, delivery_point: nil, services: []) ⇒ OrderData
constructor
Initializes a new OrderData object.
-
#to_json(*_args) ⇒ String
Converts the OrderData object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(type:, number:, tariff_code:, from_location:, to_location:, recipient:, sender:, packages:, comment: nil, shipment_point: nil, delivery_point: nil, services: []) ⇒ OrderData
Initializes a new OrderData object.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 43 def initialize(type:, number:, tariff_code:, from_location:, to_location:, recipient:, sender:, packages:, comment: nil, shipment_point: nil, delivery_point: nil, services: []) @type = type @number = number @tariff_code = tariff_code @comment = comment @shipment_point = shipment_point @delivery_point = delivery_point @from_location = from_location @to_location = to_location @recipient = recipient @sender = sender @services = services @packages = packages validate! end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def comment @comment end |
#delivery_point ⇒ Object
Returns the value of attribute delivery_point.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def delivery_point @delivery_point end |
#from_location ⇒ Object
Returns the value of attribute from_location.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def from_location @from_location end |
#number ⇒ Object
Returns the value of attribute number.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def number @number end |
#packages ⇒ Object
Returns the value of attribute packages.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def packages @packages end |
#recipient ⇒ Object
Returns the value of attribute recipient.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def recipient @recipient end |
#sender ⇒ Object
Returns the value of attribute sender.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def sender @sender end |
#services ⇒ Object
Returns the value of attribute services.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def services @services end |
#shipment_point ⇒ Object
Returns the value of attribute shipment_point.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def shipment_point @shipment_point end |
#tariff_code ⇒ Object
Returns the value of attribute tariff_code.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def tariff_code @tariff_code end |
#to_location ⇒ Object
Returns the value of attribute to_location.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def to_location @to_location end |
#type ⇒ Object
Returns the value of attribute type.
15 16 17 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 15 def type @type end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the OrderData object to a JSON representation.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cdek_api_client/entities/order_data.rb', line 63 def to_json(*_args) { type: @type, number: @number, tariff_code: @tariff_code, comment: @comment, shipment_point: @shipment_point, delivery_point: @delivery_point, from_location: @from_location, to_location: @to_location, recipient: @recipient, sender: @sender, services: @services, packages: @packages }.to_json end |