Class: CDEKApiClient::Entities::Intakes
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::Intakes
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/intakes.rb
Overview
Represents an intakes entity for courier intake requests in the CDEK API.
Instance Attribute Summary collapse
-
#cdek_number ⇒ Object
Returns the value of attribute cdek_number.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#from_location ⇒ Object
Returns the value of attribute from_location.
-
#height ⇒ Object
Returns the value of attribute height.
-
#intake_date ⇒ Object
Returns the value of attribute intake_date.
-
#intake_time_from ⇒ Object
Returns the value of attribute intake_time_from.
-
#intake_time_to ⇒ Object
Returns the value of attribute intake_time_to.
-
#length ⇒ Object
Returns the value of attribute length.
-
#lunch_time_from ⇒ Object
Returns the value of attribute lunch_time_from.
-
#lunch_time_to ⇒ Object
Returns the value of attribute lunch_time_to.
-
#name ⇒ Object
Returns the value of attribute name.
-
#need_call ⇒ Object
Returns the value of attribute need_call.
-
#sender ⇒ Object
Returns the value of attribute sender.
-
#weight ⇒ Object
Returns the value of attribute weight.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(cdek_number:, intake_date:, intake_time_from:, intake_time_to:, name:, sender:, from_location:, lunch_time_from: nil, lunch_time_to: nil, need_call: nil, comment: nil, weight: nil, length: nil, width: nil, height: nil) ⇒ Intakes
constructor
Initializes a new Intakes object.
-
#to_json(*_args) ⇒ String
Converts the Intakes object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(cdek_number:, intake_date:, intake_time_from:, intake_time_to:, name:, sender:, from_location:, lunch_time_from: nil, lunch_time_to: nil, need_call: nil, comment: nil, weight: nil, length: nil, width: nil, height: nil) ⇒ Intakes
Initializes a new Intakes object.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 49 def initialize(cdek_number:, intake_date:, intake_time_from:, intake_time_to:, name:, sender:, from_location:, lunch_time_from: nil, lunch_time_to: nil, need_call: nil, comment: nil, weight: nil, length: nil, width: nil, height: nil) @cdek_number = cdek_number @intake_date = intake_date @intake_time_from = intake_time_from @intake_time_to = intake_time_to @lunch_time_from = lunch_time_from @lunch_time_to = lunch_time_to @name = name @need_call = need_call @comment = comment @sender = sender @from_location = from_location @weight = weight @length = length @width = width @height = height validate! end |
Instance Attribute Details
#cdek_number ⇒ Object
Returns the value of attribute cdek_number.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def cdek_number @cdek_number end |
#comment ⇒ Object
Returns the value of attribute comment.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def comment @comment end |
#from_location ⇒ Object
Returns the value of attribute from_location.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def from_location @from_location end |
#height ⇒ Object
Returns the value of attribute height.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def height @height end |
#intake_date ⇒ Object
Returns the value of attribute intake_date.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def intake_date @intake_date end |
#intake_time_from ⇒ Object
Returns the value of attribute intake_time_from.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def intake_time_from @intake_time_from end |
#intake_time_to ⇒ Object
Returns the value of attribute intake_time_to.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def intake_time_to @intake_time_to end |
#length ⇒ Object
Returns the value of attribute length.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def length @length end |
#lunch_time_from ⇒ Object
Returns the value of attribute lunch_time_from.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def lunch_time_from @lunch_time_from end |
#lunch_time_to ⇒ Object
Returns the value of attribute lunch_time_to.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def lunch_time_to @lunch_time_to end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def name @name end |
#need_call ⇒ Object
Returns the value of attribute need_call.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def need_call @need_call end |
#sender ⇒ Object
Returns the value of attribute sender.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def sender @sender end |
#weight ⇒ Object
Returns the value of attribute weight.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def weight @weight end |
#width ⇒ Object
Returns the value of attribute width.
11 12 13 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 11 def width @width end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the Intakes object to a JSON representation.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/cdek_api_client/entities/intakes.rb', line 74 def to_json(*_args) data = { cdek_number: @cdek_number, intake_date: @intake_date, intake_time_from: @intake_time_from, intake_time_to: @intake_time_to, name: @name, sender: @sender, from_location: @from_location } data[:lunch_time_from] = @lunch_time_from if @lunch_time_from data[:lunch_time_to] = @lunch_time_to if @lunch_time_to data[:need_call] = @need_call unless @need_call.nil? data[:comment] = @comment if @comment data[:weight] = @weight if @weight data[:length] = @length if @length data[:width] = @width if @width data[:height] = @height if @height data.to_json end |