social_rebate 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/social_rebate/connection.rb +2 -2
- data/lib/social_rebate/version.rb +1 -1
- data/spec/social_rebate_spec.rb +5 -5
- metadata +2 -2
|
@@ -101,13 +101,13 @@ module SocialRebate
|
|
|
101
101
|
|
|
102
102
|
def check_put_url(url)
|
|
103
103
|
if url !~ /\/v[0-9]+\/orders\/[0-9a-zA-Z]+\/$/i
|
|
104
|
-
raise ResponseError.new("Incorrect put request url, expected: /api/v[0-9]/orders/<your order id
|
|
104
|
+
raise ResponseError.new("Incorrect put request url, expected: /api/v[0-9]/orders/<your order id>/, but you have #{url}")
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def check_post_url(url)
|
|
109
109
|
if url !~ /\/v[0-9]+\/orders\/$/i
|
|
110
|
-
raise ResponseError.new("Incorrect post request url, expected: /api/v[0-9]/orders
|
|
110
|
+
raise ResponseError.new("Incorrect post request url, expected: /api/v[0-9]/orders/, but you have #{url}")
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
end
|
data/spec/social_rebate_spec.rb
CHANGED
|
@@ -6,7 +6,7 @@ describe SocialRebate do
|
|
|
6
6
|
@creds[:api_key] = SocialRebate::Config.api_key
|
|
7
7
|
@creds[:api_secret] = SocialRebate::Config.api_secret
|
|
8
8
|
@creds[:store_key] = SocialRebate::Config.store_key
|
|
9
|
-
@cn =
|
|
9
|
+
@cn = {}
|
|
10
10
|
SocialRebate::Connection.stub(:new).with(@creds).and_return(@cn)
|
|
11
11
|
@token = 'token'
|
|
12
12
|
@option = {:order_email => 'email', :total_purchase => '10', :order_id => 1000}
|
|
@@ -15,7 +15,7 @@ describe SocialRebate do
|
|
|
15
15
|
describe "verify" do
|
|
16
16
|
it "should receive correct params for put request" do
|
|
17
17
|
@option[:status] = "VERIFIED"
|
|
18
|
-
@cn.
|
|
18
|
+
@cn.should_receive(:put).with("/api/v2/orders/#{@token}/", @option)
|
|
19
19
|
SocialRebate.verify(@token, @option)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -23,14 +23,14 @@ describe SocialRebate do
|
|
|
23
23
|
describe "cancel" do
|
|
24
24
|
it "should receive correct params for cancel request" do
|
|
25
25
|
@option[:status] = "VOID"
|
|
26
|
-
@cn.
|
|
27
|
-
SocialRebate.
|
|
26
|
+
@cn.should_receive(:put).with("/api/v2/orders/#{@token}/", @option)
|
|
27
|
+
SocialRebate.cancel(@token, @option)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe "init" do
|
|
32
32
|
it "should receive correct params for social rebate request" do
|
|
33
|
-
@cn.
|
|
33
|
+
@cn.should_receive(:post).with("/api/v2/orders/", @option)
|
|
34
34
|
SocialRebate.init(@option)
|
|
35
35
|
end
|
|
36
36
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: social_rebate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-09-
|
|
12
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|