Class: Io::Flow::V0::Models::LocalizedPrice

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

Overview

The localized prices for an item are returned as a list - the key of each element is defined here

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalizedPrice

Returns a new instance of LocalizedPrice.



5088
5089
5090
5091
5092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5088

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key], 'LocalizedPrice')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
end

Instance Attribute Details

#key ⇒ Object (readonly)

Returns the value of attribute key.



5086
5087
5088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5086

def key
  @key
end

Instance Method Details

#subtype_to_hash ⇒ Object



5094
5095
5096
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5094

def subtype_to_hash
  raise 'Cannot serialize an instance of localized_price directly - must use one of the specific types: localized_item_price, localized_item_vat, localized_item_duty, localized_total'
end

#to_hash ⇒ Object



5098
5099
5100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5098

def to_hash
  subtype_to_hash.merge(:key => @key)
end