sweettooth 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c25d2dad930f01702ec9f332a73cd7a25cf7e509
4
- data.tar.gz: c8b2668e549834d0f9be3b4202ac77986b88bf08
3
+ metadata.gz: e81152b64a5d4b1fe3d53b305e10678cd950cb67
4
+ data.tar.gz: e24c57e01f87da3b45b9b56c9150770845d5f57c
5
5
  SHA512:
6
- metadata.gz: 603faf1752792593d0be4ff22d677d6bee812d69700f4baf062bd9f98404e39d5db6e37d4e31142e59d31042918749e69d7c6fe6d5f888955803a0281204db9e
7
- data.tar.gz: eb20d0dea61cad5ba3e353fe7a191652f3eb87d4b28e07210ba199231507364d2ba2183070002e63de7dbd4e917af7d8e0a02bbc26b80bf6142f85f0aa649c96
6
+ metadata.gz: 161641d081452aee9091542352a86d66182137b22399636860ec92f3675435afbcaea839a67f265aed53af6dd141b51d023bd095fb90dee58291c135561427ba
7
+ data.tar.gz: a2b458d3e585c2ea8556f6900e68421723dc7cff86606f9cbf12c098e0ad46c6f6112beeb795eba7aeb98c753c301f5227926b8cada7e23894382e0ec22aaf95
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -25,8 +25,8 @@ require 'sweettooth/singleton_api_resource'
25
25
  require 'sweettooth/collection_object'
26
26
  require 'sweettooth/activity'
27
27
  require 'sweettooth/customer'
28
- require 'sweettooth/redemption'
29
- require 'sweettooth/redemption_option'
28
+ require 'sweettooth/spending'
29
+ require 'sweettooth/spending_option'
30
30
 
31
31
  # Errors
32
32
  require 'sweettooth/errors/sweettooth_error'
@@ -0,0 +1,15 @@
1
+ module SweetTooth
2
+ class Spending < APIResource
3
+ include SweetTooth::APIOperations::Create
4
+
5
+ def cancel()
6
+ response, api_key = SweetTooth.request(:post, cancel_url, @api_key)
7
+ refresh_from(response, api_key)
8
+ self
9
+ end
10
+
11
+ def cancel_url
12
+ url + '/cancel'
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module SweetTooth
2
- class RedemptionOption < APIResource
2
+ class SpendingOption < APIResource
3
3
  include SweetTooth::APIOperations::List
4
4
  end
5
5
  end
@@ -19,8 +19,8 @@ module SweetTooth
19
19
  @object_classes ||= {
20
20
  'activity' => Activity,
21
21
  'customer' => Customer,
22
- 'redemption' => Redemption,
23
- 'redemption_option' => RedemptionOption,
22
+ 'spending' => Spending,
23
+ 'spending_option' => SpendingOption,
24
24
  'collection' => CollectionObject,
25
25
  }
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module SweetTooth
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -0,0 +1,14 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module SweetTooth
4
+ class SpendingOptionTest < Test::Unit::TestCase
5
+
6
+ should "spending options should be listable" do
7
+ @mock.expects(:get).once.returns(test_response(test_spending_option_array))
8
+ c = SweetTooth::SpendingOption.all.items
9
+ assert c.kind_of? Array
10
+ assert c[0].kind_of? SweetTooth::SpendingOption
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module SweetTooth
4
+ class SpendingTest < Test::Unit::TestCase
5
+
6
+ should "create should return a new spending" do
7
+ @mock.expects(:post).once.returns(test_response(test_spending))
8
+ r = SweetTooth::Spending.create
9
+ assert_equal "spe_test_spending", r.id
10
+ end
11
+
12
+ end
13
+ end
@@ -72,13 +72,12 @@ def test_activity(params={})
72
72
  }.merge(params)
73
73
  end
74
74
 
75
- def test_redemption(params={})
75
+ def test_spending(params={})
76
76
  {
77
- :_object => "redemption",
78
- :id => "red_test_redemption",
77
+ :_object => "spending",
78
+ :id => "spe_test_spending",
79
79
  :customer_id => "cus_test_customer",
80
- :channel_id => "cha_test_channel",
81
- :redemption_option_id => "rop_test_redemption_option",
80
+ :spending_option_id => "spo_test_spending_option",
82
81
  :status => "completed",
83
82
  :comment => nil,
84
83
  :created => "2014-01-14T19:25:32.000Z",
@@ -86,23 +85,23 @@ def test_redemption(params={})
86
85
  }.merge(params)
87
86
  end
88
87
 
89
- def test_redemption_option(params={})
88
+ def test_spending_option(params={})
90
89
  {
91
- :_object => "redemption_option",
92
- :id => "rop_test_redemption_option",
93
- :account_id => "acc_test_account",
94
- :name => "Free Shipping",
95
- :description => "Spend 100 points to receive free shipping",
90
+ :_object => "spending_option",
91
+ :id => "spo_test_spending_option",
92
+ :readable_id => "gift_item",
93
+ :name => "Gift Item",
94
+ :description => "Spend 100 points to receive an exclusive gift package",
96
95
  :created => "2014-01-14T17:25:32.000Z",
97
96
  :updated => "2014-01-14T17:25:32.000Z"
98
97
  }.merge(params)
99
98
  end
100
99
 
101
- def test_redemption_option_array
100
+ def test_spending_option_array
102
101
  {
103
- :items => [test_redemption_option, test_redemption_option, test_redemption_option],
102
+ :items => [test_spending_option, test_spending_option, test_spending_option],
104
103
  :_object => 'collection',
105
- :url => '/v1/redemption_options'
104
+ :url => '/v1/spending_options'
106
105
  }
107
106
  end
108
107
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweettooth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Curtis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -133,7 +133,6 @@ files:
133
133
  - gemfiles/json.gemfile
134
134
  - gemfiles/yajl.gemfile
135
135
  - lib/sweettooth.rb
136
- - lib/sweettooth/account.rb
137
136
  - lib/sweettooth/activity.rb
138
137
  - lib/sweettooth/api_operations/create.rb
139
138
  - lib/sweettooth/api_operations/delete.rb
@@ -148,17 +147,17 @@ files:
148
147
  - lib/sweettooth/errors/invalid_request_error.rb
149
148
  - lib/sweettooth/errors/sweettooth_error.rb
150
149
  - lib/sweettooth/json.rb
151
- - lib/sweettooth/redemption.rb
152
- - lib/sweettooth/redemption_option.rb
153
150
  - lib/sweettooth/singleton_api_resource.rb
151
+ - lib/sweettooth/spending.rb
152
+ - lib/sweettooth/spending_option.rb
154
153
  - lib/sweettooth/sweettooth_object.rb
155
154
  - lib/sweettooth/util.rb
156
155
  - lib/sweettooth/version.rb
157
156
  - sweettooth.gemspec
158
157
  - test/sweettooth/activity_test.rb
159
158
  - test/sweettooth/customer_test.rb
160
- - test/sweettooth/redemption_option_test.rb
161
- - test/sweettooth/redemption_test.rb
159
+ - test/sweettooth/spending_option_test.rb
160
+ - test/sweettooth/spending_test.rb
162
161
  - test/test_helper.rb
163
162
  homepage: https://www.sweettoothrewards.com/api
164
163
  licenses: []
@@ -186,7 +185,7 @@ summary: Ruby bindings for the Sweet Tooth API
186
185
  test_files:
187
186
  - test/sweettooth/activity_test.rb
188
187
  - test/sweettooth/customer_test.rb
189
- - test/sweettooth/redemption_option_test.rb
190
- - test/sweettooth/redemption_test.rb
188
+ - test/sweettooth/spending_option_test.rb
189
+ - test/sweettooth/spending_test.rb
191
190
  - test/test_helper.rb
192
191
  has_rdoc:
@@ -1,4 +0,0 @@
1
- module SweetTooth
2
- class Account < SingletonAPIResource
3
- end
4
- end
@@ -1,5 +0,0 @@
1
- module SweetTooth
2
- class Redemption < APIResource
3
- include SweetTooth::APIOperations::Create
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module SweetTooth
4
- class RedemptionOptionTest < Test::Unit::TestCase
5
-
6
- should "redemption options should be listable" do
7
- @mock.expects(:get).once.returns(test_response(test_redemption_option_array))
8
- c = SweetTooth::RedemptionOption.all.items
9
- assert c.kind_of? Array
10
- assert c[0].kind_of? SweetTooth::RedemptionOption
11
- end
12
-
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module SweetTooth
4
- class RedemptionTest < Test::Unit::TestCase
5
-
6
- should "create should return a new redemption" do
7
- @mock.expects(:post).once.returns(test_response(test_redemption))
8
- r = SweetTooth::Redemption.create
9
- assert_equal "red_test_redemption", r.id
10
- end
11
-
12
- end
13
- end