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.



48798
48799
48800
48801
48802
48803
48804
48805
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48798

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.



48796
48797
48798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48796

def destination_country
  @destination_country
end

#fromObject (readonly)

Returns the value of attribute from.



48796
48797
48798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48796

def from
  @from
end

#origin_countryObject (readonly)

Returns the value of attribute origin_country.



48796
48797
48798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48796

def origin_country
  @origin_country
end

#toObject (readonly)

Returns the value of attribute to.



48796
48797
48798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48796

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48811
48812
48813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48811

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

#to_hashObject



48815
48816
48817
48818
48819
48820
48821
48822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48815

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

#to_jsonObject



48807
48808
48809
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48807

def to_json
  JSON.dump(to_hash)
end