jonnii-cheddargetter 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## Version 0.2.0 - 9/3/10
4
+
5
+ * Add ability to update and cancel subscriptions - [jonnii](http://github.com/jonnii)
6
+
7
+ ## Version 0.1.1 - 1/30/10
8
+
9
+ * Initial release. Features include:
10
+ * Get all plans
11
+ * Get single plan
12
+ * Get all customers
13
+ * Get single customer
14
+ * Create customer
15
+ * Update customer
data/README.markdown ADDED
@@ -0,0 +1,33 @@
1
+ # CheddarGetter
2
+
3
+ Wrapper for the Cheddar Getter API. Still in the alpha stages. Usable but
4
+ doesn't yet support the full api.
5
+
6
+ ## Installation
7
+
8
+ gem install cheddargetter
9
+
10
+ ## Usage
11
+
12
+ Create a CheddarGetter object with your username (email), password, and
13
+ product code:
14
+
15
+ @cheddar_getter = CheddarGetter.new('me@mysite.com', 'password', 'MY_PRODUCT')
16
+
17
+ Now you can call methods that correspond to the CheddarGetter API. For
18
+ example, to get a list of all plans:
19
+
20
+ @cheddar_getter.plans
21
+
22
+ For the available methods and more detailed information on each, see the
23
+ [RDocs](http://rdoc.info/github/ads/cheddargetter/master/frames) and the
24
+ [Cheddar Getter API](https://cheddargetter.com/api).
25
+
26
+ ## Contributors
27
+
28
+ Thanks to [jonnii](http://github.com/jonnii) for kicking new life into the
29
+ project by adding some new methods long after we let this thing get stale.
30
+
31
+ ## Copyright
32
+
33
+ Copyright (c) 2010 Atlantic Dominion Solutions. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -1,26 +1,27 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jonnii-cheddargetter}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Atlantic Dominion Solutions"]
12
- s.date = %q{2009-09-28}
12
+ s.date = %q{2010-09-03}
13
13
  s.description = %q{Ruby wrapper for the CheddarGetter API}
14
14
  s.email = %q{justin@adsdevshop.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.markdown"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  ".gitignore",
22
+ "CHANGELOG.markdown",
22
23
  "LICENSE",
23
- "README.rdoc",
24
+ "README.markdown",
24
25
  "Rakefile",
25
26
  "VERSION",
26
27
  "cheddargetter.gemspec",
@@ -32,7 +33,7 @@ Gem::Specification.new do |s|
32
33
  s.homepage = %q{http://github.com/ads/cheddargetter}
33
34
  s.rdoc_options = ["--charset=UTF-8"]
34
35
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.3}
36
+ s.rubygems_version = %q{1.3.7}
36
37
  s.summary = %q{Ruby wrapper for the CheddarGetter API}
37
38
  s.test_files = [
38
39
  "spec/cheddargetter_spec.rb",
@@ -44,7 +45,7 @@ Gem::Specification.new do |s|
44
45
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
46
  s.specification_version = 3
46
47
 
47
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
49
  s.add_runtime_dependency(%q<httparty>, [">= 0"])
49
50
  s.add_development_dependency(%q<rspec>, [">= 0"])
50
51
  s.add_development_dependency(%q<fakeweb>, [">= 0"])
@@ -59,3 +60,4 @@ Gem::Specification.new do |s|
59
60
  s.add_dependency(%q<fakeweb>, [">= 0"])
60
61
  end
61
62
  end
63
+
data/lib/cheddargetter.rb CHANGED
@@ -102,6 +102,14 @@ class CheddarGetter
102
102
  normalize(response, 'customers', 'customer')
103
103
  end
104
104
 
105
+ def delete_all_customers
106
+ post("/customers/delete-all/confirm/1/productCode/#{@product_code}")
107
+ end
108
+
109
+ def delete_customer(customer_code)
110
+ post("/customers/delete/productCode/#{@product_code}/code/#{customer_code}")
111
+ end
112
+
105
113
  private
106
114
 
107
115
  def get(path)
@@ -146,6 +146,30 @@ describe "an instance of CheddarGetter" do
146
146
  end
147
147
  end
148
148
 
149
+ describe 'calling #delete_all_customers' do
150
+ it "should delete all the customers" do
151
+ mock_request(:post, "/customers/delete-all/confirm/1/productCode/MY_PRODUCT", "")
152
+ @cheddar_getter.delete_all_customers
153
+ end
154
+
155
+ it "should raise if an error is returned" do
156
+ mock_request(:post, "/customers/delete-all/confirm/1/productCode/MY_PRODUCT", "<error>failed update</error>")
157
+ lambda { @cheddar_getter.delete_all_customers }.should raise_error(CheddarGetter::Error, 'failed update')
158
+ end
159
+ end
160
+
161
+ describe 'calling #delete_customer(customer_code)' do
162
+ it "should delete the customer" do
163
+ mock_request(:post, "/customers/delete/productCode/MY_PRODUCT/code/MY_CUSTOMER", "")
164
+ @cheddar_getter.delete_customer('MY_CUSTOMER')
165
+ end
166
+
167
+ it "should raise if an error is returned" do
168
+ mock_request(:post, "/customers/delete/productCode/MY_PRODUCT/code/MY_CUSTOMER", "<error>failed update</error>")
169
+ lambda { @cheddar_getter.delete_customer('MY_CUSTOMER') }.should raise_error(CheddarGetter::Error, 'failed update')
170
+ end
171
+ end
172
+
149
173
  def mock_request(method, request_path, response_xml)
150
174
  request_path.gsub!(/^\//, '')
151
175
  options = { :body => response_xml, :content_type => "text/xml" }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jonnii-cheddargetter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Atlantic Dominion Solutions
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2009-09-28 00:00:00 -04:00
18
+ date: 2010-09-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -68,12 +68,13 @@ extensions: []
68
68
 
69
69
  extra_rdoc_files:
70
70
  - LICENSE
71
- - README.rdoc
71
+ - README.markdown
72
72
  files:
73
73
  - .document
74
74
  - .gitignore
75
+ - CHANGELOG.markdown
75
76
  - LICENSE
76
- - README.rdoc
77
+ - README.markdown
77
78
  - Rakefile
78
79
  - VERSION
79
80
  - cheddargetter.gemspec
data/README.rdoc DELETED
@@ -1,26 +0,0 @@
1
- = CheddarGetter
2
-
3
- Wrapper for the Cheddar Getter API. Currently limited to the subset of API calls we actually use...
4
-
5
- == Installation
6
-
7
- gem install cheddargetter -s http://gemcutter.org/
8
-
9
- == Usage
10
-
11
- Create a CheddarGetter object with your username (email), password, and product code:
12
-
13
- @cheddar_getter = CheddarGetter.new('me@mysite.com', 'password', 'MY_PRODUCT')
14
-
15
- Now you can call methods that correspond to the CheddarGetter API. For example, to get a list of all plans:
16
-
17
- @cheddar_getter.plans
18
-
19
- For the available methods and more detailed information on each, see the RDocs and Cheddar Getter API:
20
-
21
- * RDocs: http://rdoc.info/projects/ads/cheddargetter
22
- * Cheddar Getter API: https://cheddargetter.com/api
23
-
24
- == Copyright
25
-
26
- Copyright (c) 2009 Atlantic Dominion Solutions. See LICENSE for details.