class Lightspeed::Prices
Public Class Methods
new(attributes)
click to toggle source
# File lib/lightspeed/prices.rb, line 8 def initialize(attributes) @attributes = attributes end
Public Instance Methods
[](key)
click to toggle source
# File lib/lightspeed/prices.rb, line 25 def [](key) prices[key] end
as_json()
click to toggle source
# File lib/lightspeed/prices.rb, line 16 def as_json attributes end
Also aliased as: to_h
inspect()
click to toggle source
# File lib/lightspeed/prices.rb, line 29 def inspect prices.inspect end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/lightspeed/prices.rb, line 37 def method_missing(method, *args, &block) if prices.keys.include?(method) prices[method] else super end end
prices()
click to toggle source
# File lib/lightspeed/prices.rb, line 12 def prices @prices ||= @attributes["ItemPrice"].map { |v| [v["useType"].parameterize.underscore.to_sym, BigDecimal(v["amount"])] }.to_h end
respond_to?(method, private_method)
click to toggle source
Calls superclass method
# File lib/lightspeed/prices.rb, line 33 def respond_to?(method, private_method) prices.keys.include?(method) || super end
to_json()
click to toggle source
# File lib/lightspeed/prices.rb, line 21 def to_json Yajl::Encoder.encode(as_json) end