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.



11047
11048
11049
11050
11051
11052
11053
11054
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11047

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.new(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| (x = v; x.is_a?(::Io::Flow::V0::Models::SpotRate) ? x : ::Io::Flow::V0::Models::SpotRate.new(x)) }
end

Instance Attribute Details

#experienceObject (readonly)

Returns the value of attribute experience.



11045
11046
11047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11045

def experience
  @experience
end

#pricesObject (readonly)

Returns the value of attribute prices.



11045
11046
11047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11045

def prices
  @prices
end

#ratesObject (readonly)

Returns the value of attribute rates.



11045
11046
11047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11045

def rates
  @rates
end

#spot_ratesObject (readonly)

Returns the value of attribute spot_rates.



11045
11046
11047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11045

def spot_rates
  @spot_rates
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



11060
11061
11062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11060

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

#to_hashObject



11064
11065
11066
11067
11068
11069
11070
11071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11064

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.map { |o| o.to_hash }
  }
end

#to_jsonObject



11056
11057
11058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11056

def to_json
  JSON.dump(to_hash)
end