recurly 2.5.1 → 2.5.2

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d61312d1c187372703653f203839c26488c65f9
4
- data.tar.gz: d03b58e312e5964b1c0bd05089c6e74004bf0506
3
+ metadata.gz: e2262959571c90e57a28e1e23e8b43752d9bdc4b
4
+ data.tar.gz: f330f72ffa67ab66906bb85413fc9f26ec56932d
5
5
  SHA512:
6
- metadata.gz: d895a375c37a6b4e22d7ccee798ac253fadc2e1059dae919cc7f399cd48edaae57da2370ff9ec0844f3227e7819716d11cf23839dbd7d0a7b0ee438ba13873c8
7
- data.tar.gz: 208d445b9da2003b95bf11ee15031fed3057467beed084a9158ee725aa3e82d01018b876e811420ae21bc0e5c045d102140e94b2a9435d2d4826d0317ec1b195
6
+ metadata.gz: 6acb8408b5370b56c46086b701d19f5aefa7a23d4dd73c89c5962012bd27b1c8bb087980125ec651280b6aa132ac8973ff0058a8befd5d7c812a4107c82321e8
7
+ data.tar.gz: 9dce505a4d1c0944b21ced09d53dda21aeb75428fc9d182c932efc92fcac00f31ca934aa0f6ef8ed833a1646106fd9eb18f04eb96215784d6d8f504b3bac93d5
data/README.md CHANGED
@@ -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.5.1'
15
+ gem 'recurly', '~> 2.5.2'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -1,41 +1,33 @@
1
1
  # Recurly is a Ruby client for Recurly's REST API.
2
2
  module Recurly
3
- autoload :Account, 'recurly/account'
4
- autoload :AddOn, 'recurly/add_on'
5
- autoload :Address, 'recurly/address'
6
- autoload :TaxDetail, 'recurly/tax_detail'
7
- autoload :Adjustment, 'recurly/adjustment'
8
- autoload :API, 'recurly/api'
9
- autoload :BillingInfo, 'recurly/billing_info'
10
- autoload :Coupon, 'recurly/coupon'
11
- autoload :Helper, 'recurly/helper'
12
- autoload :Invoice, 'recurly/invoice'
13
- autoload :JS, 'recurly/js'
14
- autoload :Money, 'recurly/money'
15
- autoload :Plan, 'recurly/plan'
16
- autoload :Redemption, 'recurly/redemption'
17
- autoload :Resource, 'recurly/resource'
18
- autoload :Subscription, 'recurly/subscription'
19
- autoload :SubscriptionAddOn, 'recurly/subscription_add_on'
20
- autoload :Transaction, 'recurly/transaction'
21
- autoload :Version, 'recurly/version'
22
- autoload :XML, 'recurly/xml'
23
- autoload :Webhook, 'recurly/webhook'
3
+ require 'recurly/error'
4
+ require 'recurly/helper'
5
+ require 'recurly/api'
6
+ require 'recurly/resource'
7
+ require 'recurly/billing_info'
8
+ require 'recurly/account'
9
+ require 'recurly/add_on'
10
+ require 'recurly/address'
11
+ require 'recurly/tax_detail'
12
+ require 'recurly/adjustment'
13
+ require 'recurly/coupon'
14
+ require 'recurly/helper'
15
+ require 'recurly/invoice'
16
+ require 'recurly/js'
17
+ require 'recurly/money'
18
+ require 'recurly/measured_unit'
19
+ require 'recurly/plan'
20
+ require 'recurly/redemption'
21
+ require 'recurly/subscription'
22
+ require 'recurly/subscription_add_on'
23
+ require 'recurly/transaction'
24
+ require 'recurly/usage'
25
+ require 'recurly/version'
26
+ require 'recurly/xml'
27
+ require 'recurly/webhook'
24
28
 
25
29
  @subdomain = nil
26
30
 
27
- # The exception class from which all Recurly exceptions inherit.
28
- class Error < StandardError
29
- def set_message message
30
- @message = message
31
- end
32
-
33
- # @return [String]
34
- def to_s
35
- defined? @message and @message or super
36
- end
37
- end
38
-
39
31
  # This exception is raised if Recurly has not been configured.
40
32
  class ConfigurationError < Error
41
33
  end
@@ -11,6 +11,11 @@ module Recurly
11
11
  unit_amount_in_cents
12
12
  display_quantity_on_hosted_page
13
13
  tax_code
14
+ add_on_type
15
+ measured_unit_id
16
+ optional
17
+ usage_type
18
+ usage_percentage
14
19
  created_at
15
20
  )
16
21
  alias to_param add_on_code
@@ -16,7 +16,7 @@ module Recurly
16
16
 
17
17
  @@base_uri = "https://api.recurly.com/v2/"
18
18
 
19
- RECURLY_API_VERSION = '2.1'
19
+ RECURLY_API_VERSION = '2.2'
20
20
 
21
21
  FORMATS = Helper.hash_with_indifferent_read_access(
22
22
  'pdf' => 'application/pdf',
@@ -0,0 +1,13 @@
1
+ module Recurly
2
+ # The exception class from which all Recurly exceptions inherit.
3
+ class Error < StandardError
4
+ def set_message message
5
+ @message = message
6
+ end
7
+
8
+ # @return [String]
9
+ def to_s
10
+ defined? @message and @message or super
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ module Recurly
2
+ class MeasuredUnit < Resource
3
+ define_attribute_methods %w(
4
+ id
5
+ name
6
+ display_name
7
+ description
8
+ created_at
9
+ )
10
+ alias to_param id
11
+ end
12
+ end
@@ -114,9 +114,9 @@ module Recurly
114
114
  #
115
115
  # Account.find_each { |account| p account }
116
116
  class Resource
117
- autoload :Errors, 'recurly/resource/errors'
118
- autoload :Pager, 'recurly/resource/pager'
119
- autoload :Association, 'recurly/resource/association'
117
+ require 'recurly/resource/errors'
118
+ require 'recurly/resource/pager'
119
+ require 'recurly/resource/association'
120
120
 
121
121
  # Raised when a record cannot be found.
122
122
  #
@@ -316,6 +316,12 @@ module Recurly
316
316
  # @example
317
317
  # Recurly::Account.find "heisenberg"
318
318
  # # => #<Recurly::Account account_code: "heisenberg", ...>
319
+ # Use the following identifiers for these types of objects:
320
+ # for accounts use account_code
321
+ # for plans use plan_code
322
+ # for invoices use invoice_number
323
+ # for subscriptions use uuid
324
+ # for transactions use uuid
319
325
  def find uuid, options = {}
320
326
  if uuid.nil?
321
327
  # Should we raise an ArgumentError, instead?
@@ -401,7 +407,12 @@ module Recurly
401
407
  }
402
408
  next
403
409
  end
404
-
410
+
411
+ # Nokogiri on Jruby-1.7.19 likes to throw NullPointer exceptions
412
+ # if you try to run certian operations like el.attribute(''). Since
413
+ # we dont care about text nodes, let's just skip them
414
+ next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.node_type == Nokogiri::XML::Node::TEXT_NODE
415
+
405
416
  if el.children.empty? && href = el.attribute('href')
406
417
  klass_name = Helper.classify(klass.association_class_name(el.name) ||
407
418
  el.attribute('type') ||
@@ -156,6 +156,17 @@ module Recurly
156
156
  new(attributes) { |record| record.save }
157
157
  end
158
158
 
159
+ # Instantiates a record in the scope of the pager.
160
+ #
161
+ # @return [Resource] The record.
162
+ # @example
163
+ # account = Recurly::Account.find 'schrader'
164
+ # subscription = account.subscriptions.build attributes
165
+ # @see Resource.new
166
+ def build attributes = {}
167
+ new(attributes)
168
+ end
169
+
159
170
  # Instantiates and saves a record in the scope of the pager.
160
171
  #
161
172
  # @return [Resource] The saved record.
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  class Subscription < Resource
3
- autoload :AddOns, 'recurly/subscription/add_ons'
3
+ require 'recurly/subscription/add_ons'
4
4
 
5
5
  # @macro [attach] scope
6
6
  # @scope class
@@ -1,9 +1,19 @@
1
1
  module Recurly
2
2
  class SubscriptionAddOn < Resource
3
+ # @return [MeasuredUnit]
4
+ has_one :measured_unit
5
+
6
+ # Singular because the endpoint is /usage not /usages
7
+ # @return [Usage]
8
+ has_many :usage
9
+
3
10
  define_attribute_methods %w(
4
11
  add_on_code
5
12
  quantity
6
13
  unit_amount_in_cents
14
+ add_on_type
15
+ usage_type
16
+ usage_percentage
7
17
  )
8
18
 
9
19
  attr_reader :subscription
@@ -21,6 +21,7 @@ module Recurly
21
21
  belongs_to :subscription
22
22
 
23
23
  define_attribute_methods %w(
24
+ id
24
25
  uuid
25
26
  action
26
27
  amount_in_cents
@@ -0,0 +1,23 @@
1
+ module Recurly
2
+ class Usage < Resource
3
+ # @return [MeasuredUnit]
4
+ belongs_to :measured_unit
5
+
6
+ define_attribute_methods %w(
7
+ usage_type
8
+ unit_amount_in_cents
9
+ usage_percentage
10
+ amount
11
+ merchant_tag
12
+ usage_timestamp
13
+ recording_timestamp
14
+ billed_at
15
+ created_at
16
+ updated_at
17
+ )
18
+
19
+ # Usages are only writeable and readable through {SubscriptionAddOns} instances.
20
+ embedded!
21
+ private_class_method :find
22
+ end
23
+ end
@@ -2,7 +2,7 @@ module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 5
5
- PATCH = 1
5
+ PATCH = 2
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
@@ -46,7 +46,7 @@ module Recurly
46
46
  end
47
47
 
48
48
  def to_s
49
- root.to_xml(:indent => 0).gsub(/$\n/, '')
49
+ root.to_xml(:indent => 0,:save_with => Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS).gsub(/$\n/, '')
50
50
  end
51
51
  end
52
52
 
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-19 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.2
19
+ version: '11.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.2
26
+ version: '11.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 2.6.1
33
+ version: '5.8'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 2.6.1
40
+ version: '5.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: webmock
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 1.7.6
47
+ version: '1.24'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.7.6
54
+ version: '1.24'
55
55
  description: 'An API client library for Recurly: http://recurly.com'
56
56
  email: support@recurly.com
57
57
  executables:
@@ -60,40 +60,39 @@ extensions: []
60
60
  extra_rdoc_files:
61
61
  - README.md
62
62
  files:
63
- - README.md
64
- - bin/recurly
65
63
  - lib/ecurly.rb
66
64
  - lib/rails/generators/recurly/config_generator.rb
67
65
  - lib/rails/recurly.rb
68
- - lib/recurly.rb
69
66
  - lib/recurly/account.rb
70
67
  - lib/recurly/add_on.rb
71
68
  - lib/recurly/address.rb
72
69
  - lib/recurly/adjustment.rb
73
70
  - lib/recurly/all.rb
74
- - lib/recurly/api.rb
75
71
  - lib/recurly/api/errors.rb
76
72
  - lib/recurly/api/net_http_adapter.rb
73
+ - lib/recurly/api.rb
77
74
  - lib/recurly/billing_info.rb
78
75
  - lib/recurly/coupon.rb
76
+ - lib/recurly/error.rb
79
77
  - lib/recurly/helper.rb
80
78
  - lib/recurly/invoice.rb
81
79
  - lib/recurly/js.rb
80
+ - lib/recurly/measured_unit.rb
82
81
  - lib/recurly/money.rb
83
82
  - lib/recurly/plan.rb
84
83
  - lib/recurly/redemption.rb
85
- - lib/recurly/resource.rb
86
84
  - lib/recurly/resource/association.rb
87
85
  - lib/recurly/resource/errors.rb
88
86
  - lib/recurly/resource/pager.rb
89
- - lib/recurly/subscription.rb
87
+ - lib/recurly/resource.rb
90
88
  - lib/recurly/subscription/add_ons.rb
89
+ - lib/recurly/subscription.rb
91
90
  - lib/recurly/subscription_add_on.rb
92
91
  - lib/recurly/tax_detail.rb
93
- - lib/recurly/transaction.rb
94
92
  - lib/recurly/transaction/errors.rb
93
+ - lib/recurly/transaction.rb
94
+ - lib/recurly/usage.rb
95
95
  - lib/recurly/version.rb
96
- - lib/recurly/webhook.rb
97
96
  - lib/recurly/webhook/account_notification.rb
98
97
  - lib/recurly/webhook/billing_info_updated_notification.rb
99
98
  - lib/recurly/webhook/canceled_account_notification.rb
@@ -118,32 +117,36 @@ files:
118
117
  - lib/recurly/webhook/transaction_notification.rb
119
118
  - lib/recurly/webhook/updated_subscription_notification.rb
120
119
  - lib/recurly/webhook/void_payment_notification.rb
121
- - lib/recurly/xml.rb
120
+ - lib/recurly/webhook.rb
122
121
  - lib/recurly/xml/nokogiri.rb
123
122
  - lib/recurly/xml/rexml.rb
123
+ - lib/recurly/xml.rb
124
+ - lib/recurly.rb
125
+ - README.md
126
+ - bin/recurly
124
127
  homepage: https://github.com/recurly/recurly-client-ruby
125
128
  licenses:
126
129
  - MIT
127
130
  metadata: {}
128
131
  post_install_message:
129
132
  rdoc_options:
130
- - "--main"
133
+ - --main
131
134
  - README.md
132
135
  require_paths:
133
136
  - lib
134
137
  required_ruby_version: !ruby/object:Gem::Requirement
135
138
  requirements:
136
- - - ">="
139
+ - - '>='
137
140
  - !ruby/object:Gem::Version
138
141
  version: 1.9.3
139
142
  required_rubygems_version: !ruby/object:Gem::Requirement
140
143
  requirements:
141
- - - ">="
144
+ - - '>='
142
145
  - !ruby/object:Gem::Version
143
146
  version: '0'
144
147
  requirements: []
145
148
  rubyforge_project:
146
- rubygems_version: 2.2.5
149
+ rubygems_version: 2.0.14.1
147
150
  signing_key:
148
151
  specification_version: 4
149
152
  summary: Recurly API Client