Class: FastSpring::PublicApiBase

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/fastspring-saasy/public_api_base.rb

Direct Known Subclasses

LocalizedStorePricing

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product_paths, http_request) ⇒ PublicApiBase

Returns a new instance of PublicApiBase.



6
7
8
9
10
11
12
# File 'lib/fastspring-saasy/public_api_base.rb', line 6

def initialize(product_paths, http_request)
  @company = FastSpring::Account.fetch(:company)
  @product_paths = product_paths
  @remote_ip = http_request.respond_to?(:remote_ip) ? http_request.remote_ip : "127.0.0.1"
  @http_accept_language = http_request.respond_to?(:env) ? http_request.env["HTTP_ACCEPT_LANGUAGE"] : "en"
  @http_x_forwarded_for = http_request.respond_to?(:env) ? http_request.env["HTTP_X_FORWARDED_FOR"] : ""
end

Class Method Details

.find(product_path, http_request) ⇒ Object



14
15
16
# File 'lib/fastspring-saasy/public_api_base.rb', line 14

def self.find(product_path, http_request)
  self.new(product_path, http_request).find
end