Class: Spaceship::Tunes::PricingTier
- Defined in:
- lib/spaceship/tunes/pricing_tier.rb
Instance Attribute Summary collapse
-
#pricing_info ⇒ Array of Spaceship::Tunes::PricingInfo objects
A list of all prices for the respective countries.
-
#tier_name ⇒ String
Name of the tier (e.g. “Free” for Tier 0).
-
#tier_stem ⇒ String
Number of the price Tier (e.g. “0” for Tier 0 aka Free).
Attributes inherited from Base
Class Method Summary collapse
-
.factory(attrs) ⇒ Object
Create a new object based on a hash.
Instance Method Summary collapse
Methods inherited from TunesBase
Methods inherited from Base
attr_accessor, attr_mapping, #attributes, attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#pricing_info ⇒ Array of Spaceship::Tunes::PricingInfo objects
Returns A list of all prices for the respective countries.
11 12 13 |
# File 'lib/spaceship/tunes/pricing_tier.rb', line 11 def pricing_info @pricing_info end |
#tier_name ⇒ String
Returns Name of the tier (e.g. “Free” for Tier 0).
8 9 10 |
# File 'lib/spaceship/tunes/pricing_tier.rb', line 8 def tier_name @tier_name end |
#tier_stem ⇒ String
Returns Number of the price Tier (e.g. “0” for Tier 0 aka Free).
5 6 7 |
# File 'lib/spaceship/tunes/pricing_tier.rb', line 5 def tier_stem @tier_stem end |
Class Method Details
.factory(attrs) ⇒ Object
Create a new object based on a hash. This is used to create a new object based on the server response.
21 22 23 24 25 26 |
# 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 |
Instance Method Details
#unfold_pricing_info(attrs) ⇒ Object
29 30 31 32 |
# 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 |