Class: EcwidGateway::Client

Inherits:
Weary::Client
  • Object
show all
Defined in:
lib/ecwid_gateway/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
# File 'lib/ecwid_gateway/client.rb', line 10

def initialize(attrs = {})
  attrs = EcwidGateway.options.merge(attrs)
  Config::VALID_OPTIONS_KEYS.each do |key|
    instance_variable_set("@#{key}".to_sym, attrs[key])
  end
end

Instance Method Details

#get_categories(category = 0) ⇒ Object



68
69
70
71
# File 'lib/ecwid_gateway/client.rb', line 68

def get_categories(category = 0)
  request = categories_request({:store_id => @store_id, :parent => category}).perform
  JSON.parse(request.body)
end

#get_product(product) ⇒ Object



78
79
80
81
# File 'lib/ecwid_gateway/client.rb', line 78

def get_product(product)
  request = product_request({:store_id => @store_id, :id => product}).perform
  JSON.parse(request.body)
end

#get_products(category) ⇒ Object



73
74
75
76
# File 'lib/ecwid_gateway/client.rb', line 73

def get_products(category)
  request = products_request({:store_id => @store_id, :category => category}).perform
  JSON.parse(request.body)
end

#get_profileObject



88
89
90
91
# File 'lib/ecwid_gateway/client.rb', line 88

def get_profile
  request = profile_request({:store_id => @store_id}).perform
  JSON.parse(request.body)
end

#get_random_products(count) ⇒ Object



83
84
85
86
# File 'lib/ecwid_gateway/client.rb', line 83

def get_random_products(count)
  request = random_products_request({:store_id => @store_id, :count => count}).perform
  JSON.parse(request.body)
end