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.



29078
29079
29080
29081
29082
29083
29084
29085
29086
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29078

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:service_id, :origin_country, :destination_country, :from, :to], 'TransitWindow')
  @service_id = HttpClient::Preconditions.assert_class('service_id', opts.delete(:service_id), String)
  @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), String)
  @to = HttpClient::Preconditions.assert_class('to', opts.delete(:to), String)
end

Instance Attribute Details

#destination_countryObject (readonly)

Returns the value of attribute destination_country.



29076
29077
29078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29076

def destination_country
  @destination_country
end

#fromObject (readonly)

Returns the value of attribute from.



29076
29077
29078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29076

def from
  @from
end

#origin_countryObject (readonly)

Returns the value of attribute origin_country.



29076
29077
29078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29076

def origin_country
  @origin_country
end

#service_idObject (readonly)

Returns the value of attribute service_id.



29076
29077
29078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29076

def service_id
  @service_id
end

#toObject (readonly)

Returns the value of attribute to.



29076
29077
29078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29076

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29092
29093
29094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29092

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

#to_hashObject



29096
29097
29098
29099
29100
29101
29102
29103
29104
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29096

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

#to_jsonObject



29088
29089
29090
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29088

def to_json
  JSON.dump(to_hash)
end