social_rebate 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SocialRebate
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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 = SocialRebate::Connection.new(@creds)
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.stub(:put).with("/api/v2/orders/#{@token}/", @option)
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.stub(:put).with("/api/v2/orders/#{@token}/", @option)
27
- SocialRebate.verify(@token, @option)
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.stub(:post).with("/api/v2/orders/", @option)
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
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-26 00:00:00.000000000 Z
12
+ date: 2013-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler