Class: Io::Flow::V0::Models::LocalizedPricing

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

Overview

Pricing information of a localized item

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalizedPricing

Returns a new instance of LocalizedPricing.



19573
19574
19575
19576
19577
19578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19573

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:prices], 'LocalizedPricing')
  @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LocalizedCachePrice) ? x : ::Io::Flow::V0::Models::LocalizedCachePrice.new(x)) }
  @includes = (x = opts.delete(:includes); x.nil? ? nil : HttpClient::Preconditions.assert_class('includes', x, String))
end

Instance Attribute Details

#includesObject (readonly)

Returns the value of attribute includes.



19571
19572
19573
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19571

def includes
  @includes
end

#pricesObject (readonly)

Returns the value of attribute prices.



19571
19572
19573
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19571

def prices
  @prices
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19584
19585
19586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19584

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

#to_hashObject



19588
19589
19590
19591
19592
19593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19588

def to_hash
  {
    :prices => prices.map { |o| o.to_hash },
    :includes => includes
  }
end

#to_jsonObject



19580
19581
19582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19580

def to_json
  JSON.dump(to_hash)
end