Class: CDEKApiClient::Entities::Package
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::Package
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/package.rb
Overview
Represents a package entity in the CDEK API. Each package includes attributes such as number, comment, height, length, weight, width, and items.
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#height ⇒ Object
Returns the value of attribute height.
-
#items ⇒ Object
Returns the value of attribute items.
-
#length ⇒ Object
Returns the value of attribute length.
-
#number ⇒ Object
Returns the value of attribute number.
-
#weight ⇒ Object
Returns the value of attribute weight.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(number:, comment:, height:, length:, weight:, width:, items:) ⇒ Package
constructor
Initializes a new Package object.
-
#to_json(*_args) ⇒ String
Converts the Package object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(number:, comment:, height:, length:, weight:, width:, items:) ⇒ Package
Initializes a new Package object.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cdek_api_client/entities/package.rb', line 32 def initialize(number:, comment:, height:, length:, weight:, width:, items:) @number = number @comment = comment @height = height @length = length @weight = weight @width = width @items = items validate! end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def comment @comment end |
#height ⇒ Object
Returns the value of attribute height.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def height @height end |
#items ⇒ Object
Returns the value of attribute items.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def items @items end |
#length ⇒ Object
Returns the value of attribute length.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def length @length end |
#number ⇒ Object
Returns the value of attribute number.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def number @number end |
#weight ⇒ Object
Returns the value of attribute weight.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def weight @weight end |
#width ⇒ Object
Returns the value of attribute width.
13 14 15 |
# File 'lib/cdek_api_client/entities/package.rb', line 13 def width @width end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the Package object to a JSON representation.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cdek_api_client/entities/package.rb', line 46 def to_json(*_args) { number: @number, comment: @comment, height: @height, length: @length, weight: @weight, width: @width, items: @items }.to_json end |