chargify_api_ares 1.0.5 → 1.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +12 -12
- data/HISTORY.md +13 -0
- data/chargify_api_ares.gemspec +4 -4
- data/lib/chargify_api_ares.rb +4 -0
- data/lib/chargify_api_ares/metafield_xml_formatter.rb +10 -0
- data/lib/chargify_api_ares/resources/customer_metafield.rb +5 -0
- data/lib/chargify_api_ares/resources/metafield.rb +67 -0
- data/lib/chargify_api_ares/resources/subscription_metafield.rb +5 -0
- metadata +16 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01809c6f4c91b20f5829c4fdb5c2b08431e14289
|
4
|
+
data.tar.gz: 1d3b7638b00c56e4ab7a135c284264d173069343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a84cbe5f8e4bb0d8fb999a5f9c033a1d903210205311213a93ff7e64705d9b6e71f71404c2637bbceaacfa68c67ff135e9c6a0014b5f023dac44b1774b158a6
|
7
|
+
data.tar.gz: 0f7553535d73a840bca38e7cefa0550de4f747ecf311983bb5559c5b44e9d0d32a1df3a4a609eaa2924dca785a4a5a3ec620197193b82c0536abfdd18ab6c3d7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,19 +2,19 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
chargify_api_ares (1.0.5)
|
5
|
-
activeresource (
|
5
|
+
activeresource (~> 3.2.16)
|
6
6
|
|
7
7
|
GEM
|
8
|
-
remote:
|
8
|
+
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (3.2.
|
11
|
-
activesupport (= 3.2.
|
10
|
+
activemodel (3.2.19)
|
11
|
+
activesupport (= 3.2.19)
|
12
12
|
builder (~> 3.0.0)
|
13
|
-
activeresource (3.2.
|
14
|
-
activemodel (= 3.2.
|
15
|
-
activesupport (= 3.2.
|
16
|
-
activesupport (3.2.
|
17
|
-
i18n (~> 0.6)
|
13
|
+
activeresource (3.2.19)
|
14
|
+
activemodel (= 3.2.19)
|
15
|
+
activesupport (= 3.2.19)
|
16
|
+
activesupport (3.2.19)
|
17
|
+
i18n (~> 0.6, >= 0.6.4)
|
18
18
|
multi_json (~> 1.0)
|
19
19
|
builder (3.0.4)
|
20
20
|
coderay (1.0.8)
|
@@ -34,11 +34,11 @@ GEM
|
|
34
34
|
guard-rspec (2.4.0)
|
35
35
|
guard (>= 1.1)
|
36
36
|
rspec (~> 2.11)
|
37
|
-
i18n (0.6.
|
37
|
+
i18n (0.6.11)
|
38
38
|
listen (0.7.2)
|
39
39
|
lumberjack (1.0.2)
|
40
40
|
method_source (0.8.1)
|
41
|
-
multi_json (1.
|
41
|
+
multi_json (1.10.1)
|
42
42
|
pry (0.9.12)
|
43
43
|
coderay (~> 1.0.5)
|
44
44
|
method_source (~> 0.8)
|
@@ -67,7 +67,7 @@ DEPENDENCIES
|
|
67
67
|
fakeweb (~> 1.3.0)
|
68
68
|
growl (~> 1.0.3)
|
69
69
|
guard-rspec (~> 2.4.0)
|
70
|
-
pry
|
70
|
+
pry
|
71
71
|
rake (~> 10.0.3)
|
72
72
|
rb-fsevent (~> 0.9.2)
|
73
73
|
rspec (~> 2.12.0)
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 1.0.5 / May 11 2014
|
2
|
+
|
3
|
+
### Backwards-incompatible changes
|
4
|
+
* `Chargify::Subscription` methods no longer raise exception when there is a validation error. Now you must inspect the subscription object for errors. eg:
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
subscription.reactivate
|
8
|
+
|
9
|
+
if subscription.errors.any?
|
10
|
+
# handle errors
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
1
14
|
## 1.0.0 / Nov 19 2013
|
2
15
|
|
3
16
|
### Backwards-incompatible changes
|
data/chargify_api_ares.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.7'
|
5
5
|
|
6
6
|
s.name = 'chargify_api_ares'
|
7
|
-
s.version = '1.0.
|
8
|
-
s.date = '2014-
|
7
|
+
s.version = '1.1.0.pre'
|
8
|
+
s.date = '2014-08-08'
|
9
9
|
s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
|
10
10
|
s.description = ''
|
11
11
|
s.authors = ["Michael Klett", "Nathan Verni", "Jeremy W. Rowe", "Eric Farkas"]
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = %w[lib]
|
18
18
|
|
19
19
|
# Runtime Dependencies
|
20
|
-
s.add_runtime_dependency('activeresource', '
|
20
|
+
s.add_runtime_dependency('activeresource', '~> 3.2.16')
|
21
21
|
|
22
22
|
# Development Dependencies
|
23
23
|
s.add_development_dependency('rake', '~> 10.0.3')
|
@@ -28,5 +28,5 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency('guard-rspec', '~> 2.4.0')
|
29
29
|
s.add_development_dependency('growl', '~> 1.0.3')
|
30
30
|
s.add_development_dependency('rb-fsevent', '~> 0.9.2')
|
31
|
-
s.add_development_dependency('pry'
|
31
|
+
s.add_development_dependency('pry')
|
32
32
|
end
|
data/lib/chargify_api_ares.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'active_resource'
|
2
2
|
require 'chargify_api_ares/config'
|
3
3
|
require 'chargify_api_ares/response_helper'
|
4
|
+
require 'chargify_api_ares/metafield_xml_formatter'
|
4
5
|
require 'chargify_api_ares/resources/base'
|
5
6
|
require 'chargify_api_ares/resources/charge'
|
6
7
|
require 'chargify_api_ares/resources/component'
|
@@ -19,6 +20,9 @@ require 'chargify_api_ares/resources/transaction'
|
|
19
20
|
require 'chargify_api_ares/resources/usage'
|
20
21
|
require 'chargify_api_ares/resources/webhook'
|
21
22
|
require 'chargify_api_ares/resources/invoice'
|
23
|
+
require 'chargify_api_ares/resources/metafield'
|
24
|
+
require 'chargify_api_ares/resources/customer_metafield'
|
25
|
+
require 'chargify_api_ares/resources/subscription_metafield'
|
22
26
|
|
23
27
|
require 'active_resource/version'
|
24
28
|
if defined?(::ActiveResource::VERSION::MAJOR) &&
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Chargify
|
2
|
+
class Metafield < Base
|
3
|
+
def on_csv_export?
|
4
|
+
scope.csv == "1" || scope.csv == true
|
5
|
+
end
|
6
|
+
|
7
|
+
def on_csv_export=(value)
|
8
|
+
value = (value == true || value == '1') ? '1' : '0'
|
9
|
+
scope.csv = value
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_hosted_pages?
|
13
|
+
scope.hosted.any?
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_hosted_pages=(*products)
|
17
|
+
scope.hosted = Array(products).flatten.map(&:to_s)
|
18
|
+
end
|
19
|
+
|
20
|
+
def on_hosted_pages
|
21
|
+
scope.hosted
|
22
|
+
end
|
23
|
+
|
24
|
+
# Private Interface
|
25
|
+
|
26
|
+
def self.resource; "metafield"; end
|
27
|
+
def self.element_name; "metafields"; end
|
28
|
+
|
29
|
+
def self.instantiate_record(record, prefix_options = {})
|
30
|
+
record = record.is_a?(Array) ? record.first : record
|
31
|
+
new(record, true).tap do |resource|
|
32
|
+
resource.prefix_options = prefix_options
|
33
|
+
resource.current_name = resource.name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.instantiate_collection(collection, prefix_options = {})
|
38
|
+
collection['metafields'].collect! { |record| instantiate_record(record, prefix_options) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def load_attributes_from_response(response)
|
42
|
+
if (response_code_allows_body?(response.code) &&
|
43
|
+
(response['Content-Length'].nil? || response['Content-Length'] != "0") &&
|
44
|
+
!response.body.nil? && response.body.strip.size > 0)
|
45
|
+
attributes = self.class.format.decode(response.body)
|
46
|
+
attributes = attributes.is_a?(Array) ? attributes.first : attributes
|
47
|
+
|
48
|
+
resource = load(attributes, true)
|
49
|
+
resource.current_name = resource.name
|
50
|
+
@persisted = true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def reload
|
55
|
+
raise NotImplementedError, 'Metafields do not support loading of a single record'
|
56
|
+
end
|
57
|
+
|
58
|
+
def destroy
|
59
|
+
connection.delete("#{element_path}?current_name=#{URI.encode(current_name)}")
|
60
|
+
end
|
61
|
+
|
62
|
+
def element_path(id = nil, prefix_options = {}, query_options = nil)
|
63
|
+
"#{self.class.prefix}#{self.class.element_name}.xml"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargify_api_ares
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klett
|
@@ -11,22 +11,22 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activeresource
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.
|
22
|
+
version: 3.2.16
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.
|
29
|
+
version: 3.2.16
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,16 +143,16 @@ dependencies:
|
|
143
143
|
name: pry
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
|
-
- - "
|
146
|
+
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
version: 0
|
148
|
+
version: '0'
|
149
149
|
type: :development
|
150
150
|
prerelease: false
|
151
151
|
version_requirements: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 0
|
155
|
+
version: '0'
|
156
156
|
description: ''
|
157
157
|
email: support@chargify.com
|
158
158
|
executables: []
|
@@ -180,13 +180,16 @@ files:
|
|
180
180
|
- examples/transactions.rb
|
181
181
|
- lib/chargify_api_ares.rb
|
182
182
|
- lib/chargify_api_ares/config.rb
|
183
|
+
- lib/chargify_api_ares/metafield_xml_formatter.rb
|
183
184
|
- lib/chargify_api_ares/resources/base.rb
|
184
185
|
- lib/chargify_api_ares/resources/charge.rb
|
185
186
|
- lib/chargify_api_ares/resources/component.rb
|
186
187
|
- lib/chargify_api_ares/resources/coupon.rb
|
187
188
|
- lib/chargify_api_ares/resources/customer.rb
|
189
|
+
- lib/chargify_api_ares/resources/customer_metafield.rb
|
188
190
|
- lib/chargify_api_ares/resources/event.rb
|
189
191
|
- lib/chargify_api_ares/resources/invoice.rb
|
192
|
+
- lib/chargify_api_ares/resources/metafield.rb
|
190
193
|
- lib/chargify_api_ares/resources/migration.rb
|
191
194
|
- lib/chargify_api_ares/resources/payment_profile.rb
|
192
195
|
- lib/chargify_api_ares/resources/product.rb
|
@@ -195,6 +198,7 @@ files:
|
|
195
198
|
- lib/chargify_api_ares/resources/site.rb
|
196
199
|
- lib/chargify_api_ares/resources/statement.rb
|
197
200
|
- lib/chargify_api_ares/resources/subscription.rb
|
201
|
+
- lib/chargify_api_ares/resources/subscription_metafield.rb
|
198
202
|
- lib/chargify_api_ares/resources/transaction.rb
|
199
203
|
- lib/chargify_api_ares/resources/usage.rb
|
200
204
|
- lib/chargify_api_ares/resources/webhook.rb
|
@@ -234,9 +238,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
238
|
version: '0'
|
235
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
240
|
requirements:
|
237
|
-
- - "
|
241
|
+
- - ">"
|
238
242
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
243
|
+
version: 1.3.1
|
240
244
|
requirements: []
|
241
245
|
rubyforge_project:
|
242
246
|
rubygems_version: 2.2.2
|