Module: SocialRebate
- Defined in:
- lib/social_rebate.rb,
lib/social_rebate/config.rb,
lib/social_rebate/version.rb,
lib/social_rebate/connection.rb
Defined Under Namespace
Classes: Config, Connection
Constant Summary
collapse
- VERSION =
"0.0.5"
Class Method Summary
collapse
Class Method Details
.cancel(token, option = {}) ⇒ Object
16
17
18
19
20
|
# File 'lib/social_rebate.rb', line 16
def self.cancel(token, option={})
return unless is_enabled?
option[:status] ||= 'VOID'
SocialRebate::Connection.new(creds).put("#{sub_base_uri}#{token}/", option)
end
|
.creds ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/social_rebate.rb', line 32
def self.creds
creds = {}
creds[:api_key] ||= Config.api_key
creds[:api_secret] ||= Config.api_secret
creds[:store_key] ||= Config.store_key
creds
end
|
.get(option = {}, url = '/api/v2/orders/') ⇒ Object
27
28
29
30
|
# File 'lib/social_rebate.rb', line 27
def self.get(option={}, url='/api/v2/orders/')
return unless is_enabled?
SocialRebate::Connection.new(creds).get(url)
end
|
.init(option = {}) ⇒ Object
22
23
24
25
|
# File 'lib/social_rebate.rb', line 22
def self.init(option={})
return unless is_enabled?
SocialRebate::Connection.new(creds).post(sub_base_uri, option)
end
|
.is_enabled? ⇒ Boolean
44
45
46
|
# File 'lib/social_rebate.rb', line 44
def self.is_enabled?
Config.enabled?
end
|
.sub_base_uri ⇒ Object
40
41
42
|
# File 'lib/social_rebate.rb', line 40
def self.sub_base_uri
"/api/#{Config.api_version}/orders/"
end
|
.verify(token, option = {}) ⇒ Object
10
11
12
13
14
|
# File 'lib/social_rebate.rb', line 10
def self.verify(token, option={})
return unless is_enabled?
option[:status] ||= 'VERIFIED'
SocialRebate::Connection.new(creds).put("#{sub_base_uri}#{token}/", option)
end
|