Class: Api4Over::Client
- Inherits:
-
Object
show all
- Defined in:
- lib/api4over.rb
Defined Under Namespace
Classes: NoServiceUrlError
Instance Method Summary
collapse
Constructor Details
#initialize(private_key:, public_key:, mode: 'test') ⇒ Client
Returns a new instance of Client.
9
10
11
12
13
14
|
# File 'lib/api4over.rb', line 9
def initialize(private_key:, public_key:, mode: 'test')
@api_key = public_key
@private_key = Digest::SHA256.hexdigest(private_key)
@signature = OpenSSL::HMAC.hexdigest('sha256', @private_key, "GET")
@mode = mode
end
|
Instance Method Details
#get_categories(options = {}) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/api4over.rb', line 24
def get_categories(options={})
Api4Over::PrintProducts.new.retrieve_categories(
path: "/printproducts/categories",
parameters: build_parameters_for_product(options),
mode: @mode
)
end
|
#get_option_groups(options = {}) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/api4over.rb', line 32
def get_option_groups(options={})
Api4Over::PrintProducts.new.retrieve_option_groups(
path: "/printproducts/optiongroups",
parameters: build_parameters_for_product(options),
mode: @mode
)
end
|
#get_product_feeds(options = {}) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/api4over.rb', line 40
def get_product_feeds(options={})
Api4Over::PrintProducts.new.retrieve_product_feeds(
path: "/printproducts/productsfeed",
parameters: build_parameters_for_product(options),
mode: @mode
)
end
|
#get_products(options = {}) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/api4over.rb', line 16
def get_products(options={})
Api4Over::PrintProducts.new.retrieve_products(
path: "/printproducts/products",
parameters: build_parameters_for_product(options),
mode: @mode
)
end
|
#get_quantity_discounts(options = {}) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/api4over.rb', line 48
def get_quantity_discounts(options={})
return {"status"=>"error", "status_code"=>400, "status_text"=>"Bad Request", "current_content"=>"", "message"=>"Product UUID parameter is missing"} unless options[:product_uuid]
Api4Over::PrintProducts.new.retrieve_quantity_discounts(
path: "/printproducts/products/#{options[:product_uuid]}/quantitydiscounts",
parameters: build_parameters_for_product(options),
mode: @mode
)
end
|