cheddargetter_client_rails 0.1.27 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -5
- data/Gemfile.lock +22 -13
- data/Rakefile +2 -9
- data/VERSION +1 -1
- data/cheddargetter_client_rails.gemspec +16 -13
- data/lib/cheddargetter_client_rails/subscription.rb +8 -16
- data/lib/generators/cheddargetter/templates/cheddargetter_client.rb +1 -1
- metadata +33 -17
data/Gemfile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
gem "activesupport", ">= 2.3.5"
|
3
|
-
gem "
|
3
|
+
gem "cheddargetter_client", ">= 0.0.2"
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem "rspec"
|
7
|
-
gem "bundler"
|
8
|
-
gem "jeweler"
|
9
|
-
gem "rcov"
|
6
|
+
gem "rspec"
|
7
|
+
gem "bundler"
|
8
|
+
gem "jeweler"
|
9
|
+
gem "rcov"
|
10
10
|
end
|
data/Gemfile.lock
CHANGED
@@ -2,20 +2,29 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
activesupport (3.0.7)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
cheddargetter_client (0.0.2)
|
6
|
+
crack
|
7
|
+
crack (>= 0.3.2)
|
8
|
+
httparty
|
9
|
+
httparty (>= 0.10.0)
|
10
|
+
crack (0.3.2)
|
9
11
|
diff-lcs (1.1.2)
|
10
12
|
git (1.2.5)
|
11
|
-
httparty (0.
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
httparty (0.10.0)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
multi_xml
|
16
|
+
jeweler (1.8.4)
|
17
|
+
bundler (~> 1.0)
|
15
18
|
git (>= 1.2.5)
|
16
19
|
rake
|
17
|
-
|
20
|
+
rdoc
|
21
|
+
json (1.7.6)
|
22
|
+
multi_json (1.5.0)
|
23
|
+
multi_xml (0.5.2)
|
24
|
+
rake (10.0.3)
|
18
25
|
rcov (0.9.9)
|
26
|
+
rdoc (3.12)
|
27
|
+
json (~> 1.4)
|
19
28
|
rspec (2.3.0)
|
20
29
|
rspec-core (~> 2.3.0)
|
21
30
|
rspec-expectations (~> 2.3.0)
|
@@ -30,8 +39,8 @@ PLATFORMS
|
|
30
39
|
|
31
40
|
DEPENDENCIES
|
32
41
|
activesupport (>= 2.3.5)
|
33
|
-
bundler
|
34
|
-
|
35
|
-
jeweler
|
42
|
+
bundler
|
43
|
+
cheddargetter_client (>= 0.0.2)
|
44
|
+
jeweler
|
36
45
|
rcov
|
37
|
-
rspec
|
46
|
+
rspec
|
data/Rakefile
CHANGED
@@ -21,6 +21,8 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.description = %Q{Integrates CheddarGetter api with Active Record. Uses cheddargetter_client_ruby.}
|
22
22
|
gem.email = "brent.wooden@gmail.com"
|
23
23
|
gem.authors = ["Brent Wooden"]
|
24
|
+
|
25
|
+
gem.add_dependency "cheddargetter_client", ">= 0.0.2"
|
24
26
|
# dependencies defined in Gemfile
|
25
27
|
end
|
26
28
|
Jeweler::RubygemsDotOrgTasks.new
|
@@ -38,12 +40,3 @@ end
|
|
38
40
|
|
39
41
|
task :default => :spec
|
40
42
|
|
41
|
-
require 'rake/rdoctask'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "cheddargetter_client_rails #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "cheddargetter_client_rails"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brent Wooden"]
|
@@ -56,26 +56,29 @@ Gem::Specification.new do |s|
|
|
56
56
|
|
57
57
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
58
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
|
59
|
-
s.add_runtime_dependency(%q<
|
60
|
-
s.add_development_dependency(%q<rspec>, ["
|
61
|
-
s.add_development_dependency(%q<bundler>, ["
|
62
|
-
s.add_development_dependency(%q<jeweler>, ["
|
59
|
+
s.add_runtime_dependency(%q<cheddargetter_client>, [">= 0.0.2"])
|
60
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
63
63
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<cheddargetter_client>, [">= 0.0.2"])
|
64
65
|
else
|
65
66
|
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
66
|
-
s.add_dependency(%q<
|
67
|
-
s.add_dependency(%q<rspec>, ["
|
68
|
-
s.add_dependency(%q<bundler>, ["
|
69
|
-
s.add_dependency(%q<jeweler>, ["
|
67
|
+
s.add_dependency(%q<cheddargetter_client>, [">= 0.0.2"])
|
68
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
69
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
70
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
70
71
|
s.add_dependency(%q<rcov>, [">= 0"])
|
72
|
+
s.add_dependency(%q<cheddargetter_client>, [">= 0.0.2"])
|
71
73
|
end
|
72
74
|
else
|
73
75
|
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
74
|
-
s.add_dependency(%q<
|
75
|
-
s.add_dependency(%q<rspec>, ["
|
76
|
-
s.add_dependency(%q<bundler>, ["
|
77
|
-
s.add_dependency(%q<jeweler>, ["
|
76
|
+
s.add_dependency(%q<cheddargetter_client>, [">= 0.0.2"])
|
77
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
79
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
78
80
|
s.add_dependency(%q<rcov>, [">= 0"])
|
81
|
+
s.add_dependency(%q<cheddargetter_client>, [">= 0.0.2"])
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
@@ -49,20 +49,12 @@ module CheddargetterClientRails
|
|
49
49
|
|
50
50
|
validates_presence_of :ccNumber,
|
51
51
|
:ccExpiration,
|
52
|
-
:zip
|
52
|
+
:zip
|
53
53
|
|
54
54
|
validate :unexpired
|
55
55
|
|
56
56
|
validate :validates_presence_of_humanized
|
57
57
|
|
58
|
-
def paid_plan?
|
59
|
-
!free_plan?
|
60
|
-
end
|
61
|
-
|
62
|
-
def free_plan?
|
63
|
-
planCode == 'FREE_PLAN'
|
64
|
-
end
|
65
|
-
|
66
58
|
def unexpired
|
67
59
|
if ccExpiration.present?
|
68
60
|
month, year = ccExpiration.split("/").collect{|string| string.to_i }
|
@@ -86,7 +78,7 @@ module CheddargetterClientRails
|
|
86
78
|
end
|
87
79
|
|
88
80
|
def self.get(customer_code)
|
89
|
-
response = CGClient.
|
81
|
+
response = CGClient.customers_get(:customer_code => customer_code)
|
90
82
|
|
91
83
|
if response.errors.blank?
|
92
84
|
build_from_response(response)
|
@@ -114,7 +106,7 @@ module CheddargetterClientRails
|
|
114
106
|
end
|
115
107
|
|
116
108
|
def new_record?
|
117
|
-
!Subscription.
|
109
|
+
!Subscription.customers_get({:customer_code =>customerCode})
|
118
110
|
end
|
119
111
|
|
120
112
|
def save
|
@@ -128,8 +120,8 @@ module CheddargetterClientRails
|
|
128
120
|
end
|
129
121
|
|
130
122
|
def create
|
131
|
-
response = CGClient.
|
132
|
-
:
|
123
|
+
response = CGClient.customers_new(
|
124
|
+
:customer_code => customerCode,
|
133
125
|
:firstName => firstName,
|
134
126
|
:lastName => lastName,
|
135
127
|
:email => email,
|
@@ -162,8 +154,8 @@ module CheddargetterClientRails
|
|
162
154
|
end
|
163
155
|
|
164
156
|
def update
|
165
|
-
response = CGClient.
|
166
|
-
{:
|
157
|
+
response = CGClient.customers_edit(
|
158
|
+
{:customer_code => customerCode},
|
167
159
|
{
|
168
160
|
:firstName => firstName,
|
169
161
|
:lastName => lastName,
|
@@ -184,7 +176,7 @@ module CheddargetterClientRails
|
|
184
176
|
|
185
177
|
def destroy
|
186
178
|
raise "Invalid customer code" if customerCode.blank?
|
187
|
-
response = CGClient.
|
179
|
+
response = CGClient.customers_delete({ :code => customerCode })
|
188
180
|
|
189
181
|
add_errors_or_return_valid_response(response)
|
190
182
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
cheddargetter_config = YAML.load_file(File.join(Rails.root, 'config', 'cheddargetter.yml'))[Rails.env]
|
2
|
-
CGClient =
|
2
|
+
CGClient = Cheddargetter::Client.new(
|
3
3
|
:product_code => cheddargetter_config['product_code'],
|
4
4
|
:username => cheddargetter_config['username'],
|
5
5
|
:password => cheddargetter_config['password']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheddargetter_client_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -28,13 +28,13 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 2.3.5
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: cheddargetter_client
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 0.0.2
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,55 +42,55 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.0.2
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rspec
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: bundler
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '0'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: jeweler
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '0'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
93
|
+
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: rcov
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: cheddargetter_client
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.0.2
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.0.2
|
110
126
|
description: Integrates CheddarGetter api with Active Record. Uses cheddargetter_client_ruby.
|
111
127
|
email: brent.wooden@gmail.com
|
112
128
|
executables: []
|
@@ -157,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
173
|
version: '0'
|
158
174
|
segments:
|
159
175
|
- 0
|
160
|
-
hash:
|
176
|
+
hash: 534158962696064419
|
161
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
178
|
none: false
|
163
179
|
requirements:
|