Class: Io::Flow::V0::Models::ShopifyLocalizedVariantPrices

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

Returns a new instance of ShopifyLocalizedVariantPrices.



49682
49683
49684
49685
49686
49687
49688
49689
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49682

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item], 'ShopifyLocalizedVariantPrices')
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x))
  @compare_at = (x = opts.delete(:compare_at); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x)))
  @vat = (x = opts.delete(:vat); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x)))
  @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShopifyPrice) ? x : ::Io::Flow::V0::Models::ShopifyPrice.new(x)))
end

Instance Attribute Details

#compare_atObject (readonly)

Returns the value of attribute compare_at.



49680
49681
49682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49680

def compare_at
  @compare_at
end

#dutyObject (readonly)

Returns the value of attribute duty.



49680
49681
49682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49680

def duty
  @duty
end

#itemObject (readonly)

Returns the value of attribute item.



49680
49681
49682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49680

def item
  @item
end

#vatObject (readonly)

Returns the value of attribute vat.



49680
49681
49682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49680

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49695
49696
49697
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49695

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

#to_hashObject



49699
49700
49701
49702
49703
49704
49705
49706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49699

def to_hash
  {
    :item => item.to_hash,
    :compare_at => compare_at.nil? ? nil : compare_at.to_hash,
    :vat => vat.nil? ? nil : vat.to_hash,
    :duty => duty.nil? ? nil : duty.to_hash
  }
end

#to_jsonObject



49691
49692
49693
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49691

def to_json
  JSON.dump(to_hash)
end