Class: Io::Flow::V0::Models::LocalizedCachePrice

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Represents a specific localized price

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalizedCachePrice

Returns a new instance of LocalizedCachePrice.



19201
19202
19203
19204
19205
19206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19201

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :price], 'LocalizedCachePrice')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



19199
19200
19201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19199

def key
  @key
end

#priceObject (readonly)

Returns the value of attribute price.



19199
19200
19201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19199

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19212
19213
19214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19212

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

#to_hashObject



19216
19217
19218
19219
19220
19221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19216

def to_hash
  {
    :key => key,
    :price => price.to_hash
  }
end

#to_jsonObject



19208
19209
19210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19208

def to_json
  JSON.dump(to_hash)
end