jsmestad-chargify 0.3.2.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/changelog.md +6 -0
- data/jsmestad-chargify.gemspec +3 -2
- data/lib/chargify.rb +9 -14
- data/lib/chargify/product_family.rb +47 -0
- metadata +5 -5
data/Gemfile
CHANGED
@@ -4,19 +4,17 @@ group :runtime do
|
|
4
4
|
gem 'httparty', '~> 0.6.1'
|
5
5
|
gem 'hashie', '~> 0.1.8'
|
6
6
|
gem 'json'
|
7
|
-
gem 'activesupport', '~> 3.0.0'
|
7
|
+
gem 'activesupport', '~> 3.0.0'
|
8
8
|
gem 'i18n'
|
9
9
|
end
|
10
10
|
|
11
11
|
group :test do
|
12
12
|
gem 'jeweler'
|
13
13
|
gem 'rake'
|
14
|
-
gem 'fakeweb', '>= 1.
|
14
|
+
gem 'fakeweb', '>= 1.3.0'
|
15
15
|
gem 'mocha', '~> 0.9.8'
|
16
16
|
gem 'rspec', '~> 2.0.0.beta.22'
|
17
|
-
|
18
17
|
gem 'autotest'
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
20
|
# vim: ft=ruby
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/changelog.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.3.3 October 01, 2010
|
4
|
+
* ProductFamily support (.find, .all, .find_by_handle, .components)
|
5
|
+
|
6
|
+
## 0.3.2 September 2010
|
7
|
+
* Support for Customer.find_or_create method
|
8
|
+
|
3
9
|
## 0.3.0.pre July 08, 2010
|
4
10
|
* Complete API Rewrite, please view wiki for API documentation
|
5
11
|
|
data/jsmestad-chargify.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jsmestad-chargify}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wynn Netherland", "Justin Smestad"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-02}
|
13
13
|
s.email = %q{justin.smestad@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/chargify/error.rb",
|
34
34
|
"lib/chargify/parser.rb",
|
35
35
|
"lib/chargify/product.rb",
|
36
|
+
"lib/chargify/product_family.rb",
|
36
37
|
"lib/chargify/subscription.rb",
|
37
38
|
"lib/chargify/transaction.rb",
|
38
39
|
"spec/fixtures/charge_subscription.json",
|
data/lib/chargify.rb
CHANGED
@@ -6,18 +6,13 @@ require 'active_support/core_ext/hash'
|
|
6
6
|
Hash.send :include, Hashie::HashExtensions
|
7
7
|
|
8
8
|
module Chargify
|
9
|
-
|
10
|
-
autoload :
|
11
|
-
autoload :
|
12
|
-
autoload :
|
13
|
-
autoload :
|
14
|
-
autoload :
|
15
|
-
autoload :
|
16
|
-
autoload :Subscription,
|
17
|
-
autoload :Transaction,
|
18
|
-
|
19
|
-
# TODO: migrate away from generic errors
|
20
|
-
# Replace with Chargify::Errors
|
21
|
-
|
22
|
-
|
9
|
+
autoload :Base, 'chargify/base'
|
10
|
+
autoload :Config, 'chargify/config'
|
11
|
+
autoload :Customer, 'chargify/customer'
|
12
|
+
autoload :Error, 'chargify/error'
|
13
|
+
autoload :Parser, 'chargify/parser'
|
14
|
+
autoload :Product, 'chargify/product'
|
15
|
+
autoload :ProductFamily, 'chargify/product_family'
|
16
|
+
autoload :Subscription, 'chargify/subscription'
|
17
|
+
autoload :Transaction, 'chargify/transaction'
|
23
18
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Chargify
|
2
|
+
class ProductFamily < Base
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def all
|
6
|
+
result = api_request(:get, "/product_families.json")
|
7
|
+
result.map {|p| Hashie::Mash.new p['product_family']}
|
8
|
+
end
|
9
|
+
|
10
|
+
def find!(id)
|
11
|
+
return all if id == :all
|
12
|
+
|
13
|
+
result = api_request(:get, "/product_families/#{id}.json")
|
14
|
+
Hashie::Mash.new(result).product_family
|
15
|
+
end
|
16
|
+
|
17
|
+
def find(id)
|
18
|
+
find!(id)
|
19
|
+
rescue Chargify::Error::Base => e
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def find_by_handle!(handle)
|
24
|
+
result = api_request(:get, "/product_families/lookup.json?handle=#{handle}")
|
25
|
+
Hashie::Mash.new(result).product_family
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_by_handle(handle)
|
29
|
+
find_by_handle!(handle)
|
30
|
+
rescue Chargify::Error::Base => e
|
31
|
+
return nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def components!(product_family_id)
|
35
|
+
result = api_request(:get, "/product_families/#{product_family_id}/components.json")
|
36
|
+
result.map {|p| Hashie::Mash.new p['component']}
|
37
|
+
end
|
38
|
+
|
39
|
+
def components(product_family_id)
|
40
|
+
components!(product_family_id)
|
41
|
+
rescue Chargify::Error::Base => e
|
42
|
+
return nil
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsmestad-chargify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.3.2.2
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Wynn Netherland
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2010-
|
19
|
+
date: 2010-10-02 00:00:00 -06:00
|
21
20
|
default_executable:
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
@@ -109,6 +108,7 @@ files:
|
|
109
108
|
- lib/chargify/error.rb
|
110
109
|
- lib/chargify/parser.rb
|
111
110
|
- lib/chargify/product.rb
|
111
|
+
- lib/chargify/product_family.rb
|
112
112
|
- lib/chargify/subscription.rb
|
113
113
|
- lib/chargify/transaction.rb
|
114
114
|
- spec/fixtures/charge_subscription.json
|