Class: FastSpring::Build::LocalizedStorePrices

Inherits:
Object
  • Object
show all
Defined in:
lib/fastspring-saasy/build/localized_store_prices.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pricing) ⇒ LocalizedStorePrices

Returns a new instance of LocalizedStorePrices.



6
7
8
9
10
# File 'lib/fastspring-saasy/build/localized_store_prices.rb', line 6

def initialize(pricing)
  @pricing = pricing || []
  @products = []
  @localized_pricing = {}
end

Instance Attribute Details

#localized_pricingObject (readonly)

Returns the value of attribute localized_pricing.



4
5
6
# File 'lib/fastspring-saasy/build/localized_store_prices.rb', line 4

def localized_pricing
  @localized_pricing
end

#productsObject (readonly)

Returns the value of attribute products.



4
5
6
# File 'lib/fastspring-saasy/build/localized_store_prices.rb', line 4

def products
  @products
end

Instance Method Details

#buildObject



12
13
14
15
16
17
18
# File 'lib/fastspring-saasy/build/localized_store_prices.rb', line 12

def build
  return if @pricing.empty?
  parsed = @pricing.split("\n").map { |f| f.split("=") }
  @localized_pricing = Hash[parsed]
  build_products
  self
end