Class: Io::Flow::V0::Models::Local

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 = {}) ⇒ Local

Returns a new instance of Local.



16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16601

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:experience, :prices, :rates, :spot_rates], 'Local')
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceSummary) ? x : ::Io::Flow::V0::Models::ExperienceSummary.new(x))
  @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LocalizedPrice) ? x : ::Io::Flow::V0::Models::LocalizedPrice.from_json(x)) }
  @rates = HttpClient::Preconditions.assert_class('rates', opts.delete(:rates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Rate) ? x : ::Io::Flow::V0::Models::Rate.new(x)) }
  @spot_rates = HttpClient::Preconditions.assert_class('spot_rates', opts.delete(:spot_rates), Array).map { |v| HttpClient::Preconditions.assert_class('spot_rates', HttpClient::Helper.to_object(v), Hash) }
  @status = (x = (x = opts.delete(:status); x.nil? ? "included" : x); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', HttpClient::Helper.to_object(x), Hash))
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



16599
16600
16601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

def attributes
  @attributes
end

#experienceObject (readonly)

Returns the value of attribute experience.



16599
16600
16601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

def experience
  @experience
end

#pricesObject (readonly)

Returns the value of attribute prices.



16599
16600
16601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

def prices
  @prices
end

#ratesObject (readonly)

Returns the value of attribute rates.



16599
16600
16601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

def rates
  @rates
end

#spot_ratesObject (readonly)

Returns the value of attribute spot_rates.



16599
16600
16601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

def spot_rates
  @spot_rates
end

#statusObject (readonly)

Returns the value of attribute status.



16599
16600
16601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16599

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16616
16617
16618
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16616

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

#to_hashObject



16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16620

def to_hash
  {
    :experience => experience.to_hash,
    :prices => prices.map { |o| o.to_hash },
    :rates => rates.map { |o| o.to_hash },
    :spot_rates => spot_rates,
    :status => status.value,
    :attributes => attributes
  }
end

#to_jsonObject



16612
16613
16614
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16612

def to_json
  JSON.dump(to_hash)
end