class FastSpring::LocalizedStorePricing

Public Instance Methods

base_localized_store_pricing_path() click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 12
def base_localized_store_pricing_path
  "/#{@company}/api/price"
end
find() click to toggle source

Get the localized store pricing from Saasy

# File lib/fastspring-saasy/localized_store_pricing.rb, line 4
def find
  # For some reason the implicit determination of the Txt parser does not work.
  # So we'll just blatently pass it in right now.
  @response = self.class.get(base_localized_store_pricing_path, :query => query)
  @builder = Build::LocalizedStorePrices.new(@response.parsed_response).build
  self
end
product(product_path) click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 58
def product(product_path)
  @builder.products.select { |product| product.path == product_path }.first
end
product_quantity(product_path) click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 38
def product_quantity(product_path)
  product(product_path).quantity
end
product_unit_currency(product_path) click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 46
def product_unit_currency(product_path)
  product(product_path).unit_currency
end
product_unit_display(product_path) click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 50
def product_unit_display(product_path)
  product(product_path).unit_display
end
product_unit_html(product_path) click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 54
def product_unit_html(product_path)
  product(product_path).unit_html
end
product_unit_value(product_path) click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 42
def product_unit_value(product_path)
  product(product_path).unit_value
end
query() click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 16
def query
  query_hash = Hash.new
  @product_paths.each_index{ |index| query_hash["product_#{(index + 1)}_path".to_sym] = @product_paths[index] }
  query_hash.merge({
    :user_remote_addr => @remote_ip,
    :user_accept_language => @http_accept_language,
    :user_x_forwarded_for => @http_x_forwarded_for
  })
end
user_country() click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 26
def user_country
  @builder.localized_pricing['user_country']
end
user_currency() click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 34
def user_currency
  @builder.localized_pricing['user_currency']
end
user_language() click to toggle source
# File lib/fastspring-saasy/localized_store_pricing.rb, line 30
def user_language
  @builder.localized_pricing['user_language']
end