recurly 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of recurly might be problematic. Click here for more details.

@@ -12,7 +12,7 @@ Recurly is packaged as a Ruby gem. We recommend you install it with
12
12
  [Bundler](http://gembundler.com/) by adding the following line to your Gemfile:
13
13
 
14
14
  ``` ruby
15
- gem 'recurly', '~> 2.0.3'
15
+ gem 'recurly', '~> 2.0.4'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -62,7 +62,7 @@ Instructions and examples are available on
62
62
  [Recurly's documentation site](http://docs.recurly.com/api/basics).
63
63
 
64
64
  Recurly's gem API is available
65
- [here](http://rubydoc.info/gems/recurly/2.0.3/frames).
65
+ [here](http://rubydoc.info/gems/recurly/2.0.4/frames).
66
66
 
67
67
 
68
68
  ## Contributing
@@ -23,11 +23,20 @@ module Recurly
23
23
  max_redemptions
24
24
  applies_to_all_plans
25
25
  created_at
26
- currencies
27
26
  plan_codes
28
27
  )
29
28
  alias to_param coupon_code
30
29
 
30
+ # Saves new records only.
31
+ #
32
+ # @return [true, false]
33
+ # @raise [Recurly::Error] For persisted coupons.
34
+ # @see Resource#save
35
+ def save
36
+ return super if new_record?
37
+ raise Recurly::Error, "#{self.class.collection_name} cannot be updated"
38
+ end
39
+
31
40
  # Redeem a coupon with a given account or account code.
32
41
  #
33
42
  # @return [true]
@@ -683,17 +683,14 @@ module Recurly
683
683
  value = respond_to?(key) ? send(key) : self[key]
684
684
  node = builder.add_element key
685
685
 
686
- if value.respond_to? :to_xml
686
+ # Duck-typing here is problematic because of ActiveSupport's #to_xml.
687
+ case value
688
+ when Resource, Subscription::AddOns
687
689
  value.to_xml options.merge(:builder => node)
688
- elsif value.respond_to? :each_pair
689
- value.each_pair { |k, v| node.add_element k.to_s, v }
690
- # # FIXME: We can't duck-type here because of 1.8.7 differences. We
691
- # # should come up with a more elegant solution, though, because
692
- # # this relies on Subscription::AddOns returning true for is_a? Array.
693
- #
694
- # elsif value.respond_to? :each
695
- elsif value.is_a? Array
690
+ when Array
696
691
  value.each { |e| node.add_element Helper.singularize(key), e }
692
+ when Hash
693
+ value.each_pair { |k, v| node.add_element k.to_s, v }
697
694
  else
698
695
  node.text = value
699
696
  end
@@ -2,7 +2,7 @@ module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- PATCH = 3
5
+ PATCH = 4
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
@@ -9,7 +9,10 @@ module Recurly
9
9
  end
10
10
 
11
11
  case type
12
- when 'array' then el.elements.map { |e| { e.name => XML.cast(e) } }
12
+ when 'array'
13
+ el.elements.map { |e|
14
+ e.elements.empty? ? XML.cast(e) : { e.name => XML.cast(e) }
15
+ }
13
16
  when 'boolean' then el.text == 'true'
14
17
  when 'date' then Date.parse el.text
15
18
  when 'datetime' then DateTime.parse el.text
metadata CHANGED
@@ -1,146 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
- version: !ruby/object:Gem::Version
4
- hash: 9
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.4
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 3
10
- version: 2.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Recurly
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-01 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rake
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70135646615740 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 63
30
- segments:
31
- - 0
32
- - 9
33
- - 2
20
+ - !ruby/object:Gem::Version
34
21
  version: 0.9.2
35
22
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: bundler
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70135646615740
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &70135646615240 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
29
+ requirements:
43
30
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 1923831893
46
- segments:
47
- - 1
48
- - 1
49
- - pre
50
- - 10
31
+ - !ruby/object:Gem::Version
51
32
  version: 1.1.pre.10
52
33
  type: :development
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: minitest
56
34
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70135646615240
36
+ - !ruby/object:Gem::Dependency
37
+ name: minitest
38
+ requirement: &70135646614780 !ruby/object:Gem::Requirement
58
39
  none: false
59
- requirements:
40
+ requirements:
60
41
  - - ~>
61
- - !ruby/object:Gem::Version
62
- hash: 21
63
- segments:
64
- - 2
65
- - 6
66
- - 1
42
+ - !ruby/object:Gem::Version
67
43
  version: 2.6.1
68
44
  type: :development
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: webmock
72
45
  prerelease: false
73
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70135646614780
47
+ - !ruby/object:Gem::Dependency
48
+ name: webmock
49
+ requirement: &70135646614320 !ruby/object:Gem::Requirement
74
50
  none: false
75
- requirements:
51
+ requirements:
76
52
  - - ~>
77
- - !ruby/object:Gem::Version
78
- hash: 7
79
- segments:
80
- - 1
81
- - 7
82
- - 6
53
+ - !ruby/object:Gem::Version
83
54
  version: 1.7.6
84
55
  type: :development
85
- version_requirements: *id004
86
- - !ruby/object:Gem::Dependency
87
- name: guard-minitest
88
56
  prerelease: false
89
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70135646614320
58
+ - !ruby/object:Gem::Dependency
59
+ name: guard-minitest
60
+ requirement: &70135646613860 !ruby/object:Gem::Requirement
90
61
  none: false
91
- requirements:
62
+ requirements:
92
63
  - - ~>
93
- - !ruby/object:Gem::Version
94
- hash: 15
95
- segments:
96
- - 0
97
- - 4
98
- - 0
64
+ - !ruby/object:Gem::Version
99
65
  version: 0.4.0
100
66
  type: :development
101
- version_requirements: *id005
102
- - !ruby/object:Gem::Dependency
103
- name: rb-fsevent
104
67
  prerelease: false
105
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70135646613860
69
+ - !ruby/object:Gem::Dependency
70
+ name: rb-fsevent
71
+ requirement: &70135646613400 !ruby/object:Gem::Requirement
106
72
  none: false
107
- requirements:
73
+ requirements:
108
74
  - - ~>
109
- - !ruby/object:Gem::Version
110
- hash: 97
111
- segments:
112
- - 0
113
- - 4
114
- - 3
115
- - 1
75
+ - !ruby/object:Gem::Version
116
76
  version: 0.4.3.1
117
77
  type: :development
118
- version_requirements: *id006
119
- - !ruby/object:Gem::Dependency
120
- name: growl_notify
121
78
  prerelease: false
122
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70135646613400
80
+ - !ruby/object:Gem::Dependency
81
+ name: growl_notify
82
+ requirement: &70135646612940 !ruby/object:Gem::Requirement
123
83
  none: false
124
- requirements:
84
+ requirements:
125
85
  - - ~>
126
- - !ruby/object:Gem::Version
127
- hash: 29
128
- segments:
129
- - 0
130
- - 0
131
- - 1
86
+ - !ruby/object:Gem::Version
132
87
  version: 0.0.1
133
88
  type: :development
134
- version_requirements: *id007
135
- description: "An API client library for Recurly: http://recurly.com"
89
+ prerelease: false
90
+ version_requirements: *70135646612940
91
+ description: ! 'An API client library for Recurly: http://recurly.com'
136
92
  email: support@recurly.com
137
- executables:
93
+ executables:
138
94
  - recurly
139
95
  extensions: []
140
-
141
- extra_rdoc_files:
96
+ extra_rdoc_files:
142
97
  - README.markdown
143
- files:
98
+ files:
144
99
  - lib/rails/generators/recurly/config_generator.rb
145
100
  - lib/rails/recurly.rb
146
101
  - lib/recurly/account.rb
@@ -170,40 +125,32 @@ files:
170
125
  - lib/recurly.rb
171
126
  - README.markdown
172
127
  - bin/recurly
173
- has_rdoc: true
174
128
  homepage: http://github.com/recurly/recurly-client-ruby
175
- licenses:
129
+ licenses:
176
130
  - MIT
177
131
  post_install_message:
178
- rdoc_options:
132
+ rdoc_options:
179
133
  - --main
180
134
  - README.markdown
181
- require_paths:
135
+ require_paths:
182
136
  - lib
183
- required_ruby_version: !ruby/object:Gem::Requirement
137
+ required_ruby_version: !ruby/object:Gem::Requirement
184
138
  none: false
185
- requirements:
186
- - - ">="
187
- - !ruby/object:Gem::Version
188
- hash: 3
189
- segments:
190
- - 0
191
- version: "0"
192
- required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
144
  none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
201
149
  requirements: []
202
-
203
150
  rubyforge_project:
204
- rubygems_version: 1.6.2
151
+ rubygems_version: 1.8.11
205
152
  signing_key:
206
153
  specification_version: 3
207
154
  summary: Recurly API Client
208
155
  test_files: []
209
-
156
+ has_rdoc: true