Class: CDEKApiClient::Entities::IntakeAvailableDaysResponse
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::IntakeAvailableDaysResponse
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/intake_available_days_response.rb
Overview
Represents a response with available courier intake days from the CDEK API.
Instance Attribute Summary collapse
-
#all_days ⇒ Object
Returns the value of attribute all_days.
-
#date ⇒ Object
Returns the value of attribute date.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(date: nil, all_days: nil, errors: nil, warnings: nil) ⇒ IntakeAvailableDaysResponse
constructor
Initializes a new IntakeAvailableDaysResponse object.
-
#to_json(*_args) ⇒ String
Converts the IntakeAvailableDaysResponse object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(date: nil, all_days: nil, errors: nil, warnings: nil) ⇒ IntakeAvailableDaysResponse
Initializes a new IntakeAvailableDaysResponse object.
25 26 27 28 29 30 31 |
# File 'lib/cdek_api_client/entities/intake_available_days_response.rb', line 25 def initialize(date: nil, all_days: nil, errors: nil, warnings: nil) @date = date @all_days = all_days @errors = errors || [] @warnings = warnings || [] validate! end |
Instance Attribute Details
#all_days ⇒ Object
Returns the value of attribute all_days.
11 12 13 |
# File 'lib/cdek_api_client/entities/intake_available_days_response.rb', line 11 def all_days @all_days end |
#date ⇒ Object
Returns the value of attribute date.
11 12 13 |
# File 'lib/cdek_api_client/entities/intake_available_days_response.rb', line 11 def date @date end |
#errors ⇒ Object
Returns the value of attribute errors.
11 12 13 |
# File 'lib/cdek_api_client/entities/intake_available_days_response.rb', line 11 def errors @errors end |
#warnings ⇒ Object
Returns the value of attribute warnings.
11 12 13 |
# File 'lib/cdek_api_client/entities/intake_available_days_response.rb', line 11 def warnings @warnings end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the IntakeAvailableDaysResponse object to a JSON representation.
36 37 38 39 40 41 42 43 |
# File 'lib/cdek_api_client/entities/intake_available_days_response.rb', line 36 def to_json(*_args) data = {} data[:date] = @date if @date data[:all_days] = @all_days unless @all_days.nil? data[:errors] = @errors unless @errors.empty? data[:warnings] = @warnings unless @warnings.empty? data.to_json end |