Class: FastSpring::LocalizedStorePricing
Instance Method Summary
collapse
find, #initialize
Instance Method Details
#base_localized_store_pricing_path ⇒ Object
12
13
14
|
# File 'lib/fastspring-saasy/localized_store_pricing.rb', line 12
def base_localized_store_pricing_path
"/#{@company}/api/price"
end
|
#find ⇒ Object
Get the localized store pricing from Saasy
4
5
6
7
8
9
10
|
# File 'lib/fastspring-saasy/localized_store_pricing.rb', line 4
def find
@response = self.class.get(base_localized_store_pricing_path, :query => query)
@builder = Build::LocalizedStorePrices.new(@response.parsed_response).build
self
end
|
#product(product_path) ⇒ Object
58
59
60
|
# 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) ⇒ Object
38
39
40
|
# 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) ⇒ Object
46
47
48
|
# 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) ⇒ Object
50
51
52
|
# 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) ⇒ Object
54
55
56
|
# 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) ⇒ Object
42
43
44
|
# File 'lib/fastspring-saasy/localized_store_pricing.rb', line 42
def product_unit_value(product_path)
product(product_path).unit_value
end
|
#query ⇒ Object
16
17
18
19
20
21
22
23
24
|
# 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 ⇒ Object
26
27
28
|
# File 'lib/fastspring-saasy/localized_store_pricing.rb', line 26
def user_country
@builder.localized_pricing['user_country']
end
|
#user_currency ⇒ Object
34
35
36
|
# File 'lib/fastspring-saasy/localized_store_pricing.rb', line 34
def user_currency
@builder.localized_pricing['user_currency']
end
|
#user_language ⇒ Object
30
31
32
|
# File 'lib/fastspring-saasy/localized_store_pricing.rb', line 30
def user_language
@builder.localized_pricing['user_language']
end
|