class Spaceship::Tunes::PricingTier

Attributes

pricing_info[RW]

@return (Array of Spaceship::Tunes::PricingInfo objects) A list of all prices for the respective countries

tier_name[RW]

@return (String) Name of the tier (e.g. “Free” for Tier 0)

tier_stem[RW]

@return (String) Number of the price Tier (e.g. “0” for Tier 0 aka Free)

Public Class Methods

factory(attrs) click to toggle source

Create a new object based on a hash. This is used to create a new object based on the server response.

# File lib/spaceship/tunes/pricing_tier.rb, line 21
def factory(attrs)
  obj = self.new(attrs)
  obj.unfold_pricing_info(attrs['pricingInfo'])

  return obj
end

Public Instance Methods

unfold_pricing_info(attrs) click to toggle source
# File lib/spaceship/tunes/pricing_tier.rb, line 29
def unfold_pricing_info(attrs)
  unfolded_pricing_info = attrs.map { |info| PricingInfo.new(info) }
  instance_variable_set(:@pricing_info, unfolded_pricing_info)
end