Class: Io::Flow::V0::Models::TransitWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TransitWindow

Returns a new instance of TransitWindow.



34409
34410
34411
34412
34413
34414
34415
34416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34409

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:origin_country, :destination_country, :from, :to], 'TransitWindow')
  @origin_country = HttpClient::Preconditions.assert_class('origin_country', opts.delete(:origin_country), String)
  @destination_country = HttpClient::Preconditions.assert_class('destination_country', opts.delete(:destination_country), String)
  @from = HttpClient::Preconditions.assert_class('from', opts.delete(:from), Integer)
  @to = HttpClient::Preconditions.assert_class('to', opts.delete(:to), Integer)
end

Instance Attribute Details

#destination_countryObject (readonly)

Returns the value of attribute destination_country.



34407
34408
34409
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34407

def destination_country
  @destination_country
end

#fromObject (readonly)

Returns the value of attribute from.



34407
34408
34409
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34407

def from
  @from
end

#origin_countryObject (readonly)

Returns the value of attribute origin_country.



34407
34408
34409
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34407

def origin_country
  @origin_country
end

#toObject (readonly)

Returns the value of attribute to.



34407
34408
34409
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34407

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34422
34423
34424
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34422

def copy(incoming={})
  TransitWindow.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



34426
34427
34428
34429
34430
34431
34432
34433
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34426

def to_hash
  {
    :origin_country => origin_country,
    :destination_country => destination_country,
    :from => from,
    :to => to
  }
end

#to_jsonObject



34418
34419
34420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34418

def to_json
  JSON.dump(to_hash)
end