recurly 2.6.4 → 2.7.0

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
- SHA256:
3
- metadata.gz: 4db0ac90d5fe286ec16a2f9151c7ed8e14779d650d702a3d4e0eda1b4feda497
4
- data.tar.gz: 844cba17117bcc78337b90497aac3916d1d1e4e9f85900235cbcbf6f2c6cd468
2
+ SHA1:
3
+ metadata.gz: dc732a5ca8416f1d5546b1ae6817b9c1a460356f
4
+ data.tar.gz: 46a561b5db08c3751e3f137fcf48753ff745cdf9
5
5
  SHA512:
6
- metadata.gz: 6d5c5564a4792fc6701f690227bf382ad96d840990775032568947dcd47c69c15cc8723ece172a3500773eb93ad9c87c02d78103985075ba814b48d5f20e5691
7
- data.tar.gz: 217323a70d5bf095a5cd9b86559782b16564c5d59e7a0536d377d38e3a3d97ed8b346bc5f0fdb1ec16f9e5ec1fbc240be97263a1169f5eeea7f664346bbd8a13
6
+ metadata.gz: 899b14789c5b52e5168e46c94054b79098d5c36ea31a1a86dfcb9bc8939d338f81cab622f853c6584dc751fafe1e2e3a180d0b2b29463c44de3e9dc6f17a44f3
7
+ data.tar.gz: c599887af8463d163cf228eb15b625368a27017203913db1d44c71fb114e0e1d79f7c87501e2aa14ee6b0022a0d7dde3293c6ddf810192d04f278d7835d24724
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.6.3'
15
+ gem 'recurly', '~> 2.7.0'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
data/lib/recurly.rb CHANGED
@@ -6,6 +6,7 @@ module Recurly
6
6
  require 'recurly/resource'
7
7
  require 'recurly/billing_info'
8
8
  require 'recurly/account'
9
+ require 'recurly/account_balance'
9
10
  require 'recurly/add_on'
10
11
  require 'recurly/address'
11
12
  require 'recurly/tax_detail'
@@ -80,8 +81,6 @@ module Recurly
80
81
  end
81
82
 
82
83
  # Assigns a logger to log requests/responses and more.
83
- # The logger can only be set if the environment variable
84
- # `RECURLY_INSECURE_DEBUG` equals `true`.
85
84
  #
86
85
  # @return [Logger, nil]
87
86
  # @example
@@ -93,22 +92,6 @@ module Recurly
93
92
  # Recurly.logger = nil # Or Recurly.logger = Logger.new nil
94
93
  attr_accessor :logger
95
94
 
96
- def logger=(logger)
97
- if ENV['RECURLY_INSECURE_DEBUG'].to_s.downcase == 'true'
98
- @logger = logger
99
- puts <<-MSG
100
- [WARNING] Recurly logger enabled. The logger has the potential to leak
101
- PII and should never be used in production environments.
102
- MSG
103
- else
104
- puts <<-MSG
105
- [WARNING] Recurly logger has been disabled. If you wish to use it,
106
- only do so in a non-production environment and make sure
107
- the `RECURLY_INSECURE_DEBUG` environment variable is set to `true`.
108
- MSG
109
- end
110
- end
111
-
112
95
  # Convenience logging method includes a Logger#progname dynamically.
113
96
  # @return [true, nil]
114
97
  def log level, message
@@ -16,11 +16,13 @@ module Recurly
16
16
  has_many :invoices
17
17
  has_many :subscriptions
18
18
  has_many :transactions
19
+ has_many :redemptions
19
20
 
20
21
  # @return [BillingInfo, nil]
21
22
  has_one :billing_info, :readonly => false
22
23
 
23
- has_many :redemptions
24
+ # @return [AccountBalance, nil]
25
+ has_one :account_balance, :readonly => true
24
26
 
25
27
  def redemption coupon_code
26
28
  redemptions.detect { |r| r.coupon_code == coupon_code }
@@ -0,0 +1,11 @@
1
+ module Recurly
2
+ class AccountBalance < Resource
3
+ # @return [Account, nil]
4
+ has_one :account, :readonly => true
5
+
6
+ define_attribute_methods %w(
7
+ past_due
8
+ balance_in_cents
9
+ )
10
+ end
11
+ end
@@ -16,6 +16,7 @@ module Recurly
16
16
  optional
17
17
  usage_type
18
18
  usage_percentage
19
+ revenue_schedule_type
19
20
  created_at
20
21
  )
21
22
  alias to_param add_on_code
@@ -32,6 +32,7 @@ module Recurly
32
32
  end_date
33
33
  created_at
34
34
  quantity_remaining
35
+ revenue_schedule_type
35
36
 
36
37
  tax_in_cents
37
38
  tax_type
data/lib/recurly/api.rb CHANGED
@@ -15,9 +15,8 @@ module Recurly
15
15
  require 'recurly/api/errors'
16
16
 
17
17
  @@base_uri = "https://api.recurly.com/v2/"
18
- @@valid_domains = [".recurly.com"]
19
18
 
20
- RECURLY_API_VERSION = '2.2'
19
+ RECURLY_API_VERSION = '2.3'
21
20
 
22
21
  FORMATS = Helper.hash_with_indifferent_read_access(
23
22
  'pdf' => 'application/pdf',
@@ -76,13 +75,6 @@ module Recurly
76
75
  URI.parse @@base_uri.sub('api', Recurly.subdomain)
77
76
  end
78
77
 
79
- def validate_uri!(uri)
80
- domain = @@valid_domains.detect { |d| uri.host.end_with?(d) }
81
- unless domain
82
- raise ArgumentError, "URI #{uri} is invalid. You may only make requests to a Recurly domain."
83
- end
84
- end
85
-
86
78
  # @return [String]
87
79
  def user_agent
88
80
  "Recurly/#{Version}; #{RUBY_DESCRIPTION}"
@@ -43,7 +43,6 @@ module Recurly
43
43
  }
44
44
  uri += "?#{pairs.join '&'}"
45
45
  end
46
- self.validate_uri!(uri)
47
46
  request = METHODS[method].new uri.request_uri, head
48
47
  request.basic_auth(*[Recurly.api_key, nil].flatten[0, 2])
49
48
  if options[:body]
data/lib/recurly/plan.rb CHANGED
@@ -25,6 +25,8 @@ module Recurly
25
25
  total_billing_cycles
26
26
  accounting_code
27
27
  setup_fee_accounting_code
28
+ revenue_schedule_type
29
+ setup_fee_revenue_schedule_type
28
30
  tax_exempt
29
31
  tax_code
30
32
  created_at
@@ -328,8 +328,9 @@ module Recurly
328
328
  raise NotFound, "can't find a record with nil identifier"
329
329
  end
330
330
 
331
+ uri = uuid =~ /^http/ ? uuid : member_path(uuid)
331
332
  begin
332
- from_response API.get(member_path(uuid), {}, options)
333
+ from_response API.get(uri, {}, options)
333
334
  rescue API::NotFound => e
334
335
  raise NotFound, e.description
335
336
  end
@@ -609,12 +610,9 @@ module Recurly
609
610
  return if response.body.to_s.length.zero?
610
611
  fresh = self.class.from_response response
611
612
  else
612
- options = {:etag => (etag unless changed?)}
613
- fresh = if @href
614
- self.class.from_response API.get(@href, {}, options)
615
- else
616
- self.class.find(to_param, options)
617
- end
613
+ fresh = self.class.find(
614
+ @href || to_param, :etag => (etag unless changed?)
615
+ )
618
616
  end
619
617
  fresh and copy_from fresh
620
618
  persist! true
@@ -61,6 +61,7 @@ module Recurly
61
61
  customer_notes
62
62
  vat_reverse_charge_notes
63
63
  address
64
+ revenue_schedule_type
64
65
  )
65
66
  alias to_param uuid
66
67
 
@@ -20,6 +20,9 @@ module Recurly
20
20
  # @return [Subscription, nil]
21
21
  belongs_to :subscription
22
22
 
23
+ # @return [Transaction, nil]
24
+ has_one :original_transaction, class_name: 'Transaction', readonly: true
25
+
23
26
  define_attribute_methods %w(
24
27
  id
25
28
  uuid
@@ -1,8 +1,8 @@
1
1
  module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 6
5
- PATCH = 4
4
+ MINOR = 7
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.4
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2016-07-07 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
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
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
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
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
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
54
  version: '1.24'
55
55
  description: 'An API client library for Recurly: http://recurly.com'
@@ -60,20 +60,18 @@ 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
67
+ - lib/recurly/account_balance.rb
70
68
  - lib/recurly/add_on.rb
71
69
  - lib/recurly/address.rb
72
70
  - lib/recurly/adjustment.rb
73
71
  - lib/recurly/all.rb
74
- - lib/recurly/api.rb
75
72
  - lib/recurly/api/errors.rb
76
73
  - lib/recurly/api/net_http_adapter.rb
74
+ - lib/recurly/api.rb
77
75
  - lib/recurly/billing_info.rb
78
76
  - lib/recurly/coupon.rb
79
77
  - lib/recurly/error.rb
@@ -84,19 +82,18 @@ files:
84
82
  - lib/recurly/money.rb
85
83
  - lib/recurly/plan.rb
86
84
  - lib/recurly/redemption.rb
87
- - lib/recurly/resource.rb
88
85
  - lib/recurly/resource/association.rb
89
86
  - lib/recurly/resource/errors.rb
90
87
  - lib/recurly/resource/pager.rb
91
- - lib/recurly/subscription.rb
88
+ - lib/recurly/resource.rb
92
89
  - lib/recurly/subscription/add_ons.rb
90
+ - lib/recurly/subscription.rb
93
91
  - lib/recurly/subscription_add_on.rb
94
92
  - lib/recurly/tax_detail.rb
95
- - lib/recurly/transaction.rb
96
93
  - lib/recurly/transaction/errors.rb
94
+ - lib/recurly/transaction.rb
97
95
  - lib/recurly/usage.rb
98
96
  - lib/recurly/version.rb
99
- - lib/recurly/webhook.rb
100
97
  - lib/recurly/webhook/account_notification.rb
101
98
  - lib/recurly/webhook/billing_info_updated_notification.rb
102
99
  - lib/recurly/webhook/canceled_account_notification.rb
@@ -121,33 +118,38 @@ files:
121
118
  - lib/recurly/webhook/transaction_notification.rb
122
119
  - lib/recurly/webhook/updated_subscription_notification.rb
123
120
  - lib/recurly/webhook/void_payment_notification.rb
124
- - lib/recurly/xml.rb
121
+ - lib/recurly/webhook.rb
125
122
  - lib/recurly/xml/nokogiri.rb
126
123
  - lib/recurly/xml/rexml.rb
124
+ - lib/recurly/xml.rb
125
+ - lib/recurly.rb
126
+ - README.md
127
+ - bin/recurly
127
128
  homepage: https://github.com/recurly/recurly-client-ruby
128
129
  licenses:
129
130
  - MIT
130
131
  metadata: {}
131
132
  post_install_message:
132
133
  rdoc_options:
133
- - "--main"
134
+ - --main
134
135
  - README.md
135
136
  require_paths:
136
137
  - lib
137
138
  required_ruby_version: !ruby/object:Gem::Requirement
138
139
  requirements:
139
- - - ">="
140
+ - - '>='
140
141
  - !ruby/object:Gem::Version
141
142
  version: 1.9.3
142
143
  required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  requirements:
144
- - - ">="
145
+ - - '>='
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
149
  rubyforge_project:
149
- rubygems_version: 2.7.6
150
+ rubygems_version: 2.0.14.1
150
151
  signing_key:
151
152
  specification_version: 4
152
153
  summary: Recurly API Client
153
154
  test_files: []
155
+ has_rdoc: true