Class: CDEKApiClient::Entities::IntakeAvailableDaysRequest

Inherits:
Object
  • Object
show all
Includes:
Validatable
Defined in:
lib/cdek_api_client/entities/intake_available_days_request.rb

Overview

Represents a request for available courier intake days from the CDEK API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validatable

included, #validate!

Constructor Details

#initialize(from_location:, date: nil) ⇒ IntakeAvailableDaysRequest

Initializes a new IntakeAvailableDaysRequest object.

Raises:

  • (ArgumentError)

    if any attribute validation fails.



21
22
23
24
25
# File 'lib/cdek_api_client/entities/intake_available_days_request.rb', line 21

def initialize(from_location:, date: nil)
  @from_location = from_location
  @date = date
  validate!
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



11
12
13
# File 'lib/cdek_api_client/entities/intake_available_days_request.rb', line 11

def date
  @date
end

#from_locationObject

Returns the value of attribute from_location.



11
12
13
# File 'lib/cdek_api_client/entities/intake_available_days_request.rb', line 11

def from_location
  @from_location
end

Instance Method Details

#to_json(*_args) ⇒ String

Converts the IntakeAvailableDaysRequest object to a JSON representation.



30
31
32
33
34
# File 'lib/cdek_api_client/entities/intake_available_days_request.rb', line 30

def to_json(*_args)
  data = { from_location: @from_location }
  data[:date] = @date if @date
  data.to_json
end