recurly 2.4.12 → 2.5.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: 13b7bc8357cf3a9bd44bb68f50602fbd79965d4c5476e0db3a2f5499a9741235
4
- data.tar.gz: daf10aba1b1568a111ae8ac4a98f26579d4916f48fcfc8cd2726d43aa9ccd5b3
2
+ SHA1:
3
+ metadata.gz: c4b6f4de73e5245f4dc7644b7b2fef85d66b487b
4
+ data.tar.gz: 1f0834deed95841651bce343cb8dc31decce349a
5
5
  SHA512:
6
- metadata.gz: 73c853360a26ff0a48625a1070ebc03f1b80f386306089882559f37cb5353835377226f2e57b7a31c6b0e76e267b9f766dbf3ea11a54ed426df016d72c6755f5
7
- data.tar.gz: 8d7f70972b826590e36838535cb21a8f9825368727922e7696f3f5323df6905ca66b49ce15a0c6e297fb42870f7f32e4dca90f30a24fa7890942a1e1594d95a1
6
+ metadata.gz: d46980a0aadb012432ded4046e46a8062e4d7e75d95d9848f7fce3715b4dc26bd78a4f50c111f11bed930104a7c9d5ed657388b13b195aee6d708b5493f01d8e
7
+ data.tar.gz: b270c39134d6ff05cde1b84e5ee6103d07890ed7d94f310805409d7ba2395ea616f9d91e3bc114232eed7512ea8edbddfe81dfc660ac5aee698bf6d3763308f4
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.4.11'
15
+ gem 'recurly', '~> 2.5.0'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
data/lib/recurly.rb CHANGED
@@ -88,8 +88,6 @@ module Recurly
88
88
  end
89
89
 
90
90
  # Assigns a logger to log requests/responses and more.
91
- # The logger can only be set if the environment variable
92
- # `RECURLY_INSECURE_DEBUG` equals `true`.
93
91
  #
94
92
  # @return [Logger, nil]
95
93
  # @example
@@ -101,22 +99,6 @@ module Recurly
101
99
  # Recurly.logger = nil # Or Recurly.logger = Logger.new nil
102
100
  attr_accessor :logger
103
101
 
104
- def logger=(logger)
105
- if ENV['RECURLY_INSECURE_DEBUG'].to_s.downcase == 'true'
106
- @logger = logger
107
- puts <<-MSG
108
- [WARNING] Recurly logger enabled. The logger has the potential to leak
109
- PII and should never be used in production environments.
110
- MSG
111
- else
112
- puts <<-MSG
113
- [WARNING] Recurly logger has been disabled. If you wish to use it,
114
- only do so in a non-production environment and make sure
115
- the `RECURLY_INSECURE_DEBUG` environment variable is set to `true`.
116
- MSG
117
- end
118
- end
119
-
120
102
  # Convenience logging method includes a Logger#progname dynamically.
121
103
  # @return [true, nil]
122
104
  def log level, message
@@ -22,8 +22,8 @@ module Recurly
22
22
 
23
23
  has_many :redemptions
24
24
 
25
- def redemption
26
- redemptions.first
25
+ def redemption coupon_code
26
+ redemptions.detect { |r| r.coupon_code == coupon_code }
27
27
  end
28
28
 
29
29
  define_attribute_methods %w(
data/lib/recurly/api.rb CHANGED
@@ -15,7 +15,6 @@ 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
19
  RECURLY_API_VERSION = '2.1'
21
20
 
@@ -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]
@@ -24,14 +24,11 @@ module Recurly
24
24
  total_discounted_in_cents
25
25
  currency
26
26
  state
27
+ coupon_code
27
28
  subscription_uuid
28
29
  created_at
29
30
  )
30
31
 
31
- def destroy_uri
32
- uri + "s/#{uuid}"
33
- end
34
-
35
32
  def save
36
33
  return false if persisted?
37
34
  copy_from coupon.redeem account, currency
@@ -322,8 +322,9 @@ module Recurly
322
322
  raise NotFound, "can't find a record with nil identifier"
323
323
  end
324
324
 
325
+ uri = uuid =~ /^http/ ? uuid : member_path(uuid)
325
326
  begin
326
- from_response API.get(member_path(uuid), {}, options)
327
+ from_response API.get(uri, {}, options)
327
328
  rescue API::NotFound => e
328
329
  raise NotFound, e.description
329
330
  end
@@ -596,12 +597,9 @@ module Recurly
596
597
  return if response.body.to_s.length.zero?
597
598
  fresh = self.class.from_response response
598
599
  else
599
- options = {:etag => (etag unless changed?)}
600
- fresh = if @href
601
- self.class.from_response API.get(@href, {}, options)
602
- else
603
- self.class.find(to_param, options)
604
- end
600
+ fresh = self.class.find(
601
+ @href || to_param, :etag => (etag unless changed?)
602
+ )
605
603
  end
606
604
  fresh and copy_from fresh
607
605
  persist! true
@@ -919,16 +917,12 @@ module Recurly
919
917
  # race_condition.destroy # raises Recurly::Resource::NotFound
920
918
  def destroy
921
919
  return false unless persisted?
922
- @response = API.delete destroy_uri
920
+ @response = API.delete uri
923
921
  @destroyed = true
924
922
  rescue API::NotFound => e
925
923
  raise NotFound, e.description
926
924
  end
927
925
 
928
- def destroy_uri
929
- uri
930
- end
931
-
932
926
  def signable_attributes
933
927
  Hash[xml_keys.map { |key| [key, self[key]] }]
934
928
  end
@@ -1,8 +1,8 @@
1
1
  module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 4
5
- PATCH = 12
4
+ MINOR = 5
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.12
4
+ version: 2.5.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-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -143,8 +143,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.7.6
146
+ rubygems_version: 2.2.5
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Recurly API Client
150
150
  test_files: []
151
+ has_rdoc: true