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.



12174
12175
12176
12177
12178
12179
12180
12181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12174

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.



12172
12173
12174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12172

def experience
  @experience
end

#pricesObject (readonly)

Returns the value of attribute prices.



12172
12173
12174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12172

def prices
  @prices
end

#ratesObject (readonly)

Returns the value of attribute rates.



12172
12173
12174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12172

def rates
  @rates
end

#spot_ratesObject (readonly)

Returns the value of attribute spot_rates.



12172
12173
12174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12172

def spot_rates
  @spot_rates
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12187
12188
12189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12187

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

#to_hashObject



12191
12192
12193
12194
12195
12196
12197
12198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12191

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



12183
12184
12185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12183

def to_json
  JSON.dump(to_hash)
end