recurly 2.1.8 → 2.1.9

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 76c75b95cb4d9280613f61c55faf3be2cf8aadb1
4
+ data.tar.gz: ac7e65d2b87a4b2a19f2fb04ec4b966123e9d11a
5
+ SHA512:
6
+ metadata.gz: f1f9d6af15f90d289ce4d5b93f0bdbe1574bccca26cc63a5a05e207b1647e4a4b4be11110e60b9f3dd73db2156552f3ad1aa3b352b7c854cb2dac09bb6d172e8
7
+ data.tar.gz: 05c18c6c4c0972aa0f43612150e1f79227f1427ce1b040063ff0c818f6339f62960b083088797096ebec8d5c480581330fd4208a6d475eef17732b5fa7ee777a
data/README.markdown 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.1.5'
15
+ gem 'recurly', '~> 2.1.8'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -31,6 +31,7 @@ $ rails g recurly:config
31
31
  If you're not using Rails, use the following template:
32
32
 
33
33
  ``` ruby
34
+ Recurly.subdomain = ENV['RECURLY_SUBDOMAIN']
34
35
  Recurly.api_key = ENV['RECURLY_API_KEY']
35
36
  Recurly.js.private_key = ENV['RECURLY_JS_PRIVATE_KEY']
36
37
  ```
data/bin/recurly CHANGED
@@ -18,6 +18,10 @@ options = {}
18
18
  OptionParser.new do |opts|
19
19
  opts.banner = 'Usage: recurly [options] -- [irb options]'
20
20
 
21
+ opts.on '-s', '--subdomain [subdomain]', 'Your subdomain' do |subdomain|
22
+ options[:subdomain] = subdomain
23
+ end
24
+
21
25
  opts.on '-k', '--api-key [api key]', 'Your API key' do |key|
22
26
  options[:api_key] = key
23
27
  end
@@ -50,6 +54,7 @@ OptionParser.new do |opts|
50
54
  end.parse!
51
55
 
52
56
  require 'recurly/all'
57
+ Recurly.subdomain = options[:subdomain] || ENV['RECURLY_SUBDOMAIN']
53
58
  Recurly.api_key = options[:api_key] || ENV['RECURLY_API_KEY']
54
59
  Recurly.js.private_key = options[:private_key] || ENV['RECURLY_JS_PRIVATE_KEY']
55
60
  include Recurly
@@ -6,6 +6,7 @@ module Recurly
6
6
  # when running <tt>rails g recurly:config</tt>.
7
7
  def create_recurly_file
8
8
  create_file 'config/initializers/recurly.rb', <<EOF
9
+ Recurly.subdomain = ENV['RECURLY_SUBDOMAIN']
9
10
  Recurly.api_key = ENV['RECURLY_API_KEY']
10
11
  Recurly.js.private_key = ENV['RECURLY_JS_PRIVATE_KEY']
11
12
 
data/lib/recurly.rb CHANGED
@@ -19,6 +19,8 @@ module Recurly
19
19
  autoload :Version, 'recurly/version'
20
20
  autoload :XML, 'recurly/xml'
21
21
 
22
+ @subdomain = nil
23
+
22
24
  # The exception class from which all Recurly exceptions inherit.
23
25
  class Error < StandardError
24
26
  def set_message message
@@ -36,6 +38,12 @@ module Recurly
36
38
  end
37
39
 
38
40
  class << self
41
+ # @return [String] A subdomain.
42
+ def subdomain
43
+ @subdomain || 'api'
44
+ end
45
+ attr_writer :subdomain
46
+
39
47
  # @return [String] An API key.
40
48
  # @raise [ConfigurationError] If not configured.
41
49
  def api_key
data/lib/recurly/api.rb CHANGED
@@ -70,7 +70,7 @@ module Recurly
70
70
 
71
71
  # @return [URI::Generic]
72
72
  def base_uri
73
- URI.parse @@base_uri
73
+ URI.parse @@base_uri.sub('api', Recurly.subdomain)
74
74
  end
75
75
 
76
76
  # @return [String]
@@ -36,7 +36,7 @@ module Recurly
36
36
  head = headers.dup
37
37
  head.update options[:head] if options[:head]
38
38
  head.delete_if { |_, value| value.nil? }
39
- uri = base_uri + uri
39
+ uri = base_uri + URI.escape(uri)
40
40
  if options[:params] && !options[:params].empty?
41
41
  pairs = options[:params].map { |key, value|
42
42
  "#{CGI.escape key.to_s}=#{CGI.escape value.to_s}"
@@ -48,6 +48,21 @@ module Recurly
48
48
  super attributes
49
49
  end
50
50
 
51
+ class << self
52
+ # Overrides the inherited member_path method to allow for billing info's
53
+ # irregular URL structure.
54
+ #
55
+ # @return [String] The relative path to an account's billing info from the
56
+ # API's base URI.
57
+ # @param uuid [String]
58
+ # @example
59
+ # Recurly::BillingInfo.member_path "code"
60
+ # # => "accounts/code/billing_info"
61
+ def member_path uuid
62
+ "accounts/#{uuid}/billing_info"
63
+ end
64
+ end
65
+
51
66
  # Billing info is only writeable through an {Account} instance.
52
67
  embedded!
53
68
  end
@@ -25,6 +25,7 @@ module Recurly
25
25
  created_at
26
26
  plan_codes
27
27
  description
28
+ invoice_description
28
29
  )
29
30
  alias to_param coupon_code
30
31
 
data/lib/recurly/money.rb CHANGED
@@ -13,11 +13,13 @@ module Recurly
13
13
  # # Using a default currency.
14
14
  # Recurly.default_currency = 'USD'
15
15
  # Recurly::Money.new(49_00) # => #<Recurly::Money USD: 49_00>
16
- def initialize currencies = {}
16
+ def initialize currencies = {}, parent = nil, attribute = nil
17
17
  @currencies = {}
18
+ @parent = parent
19
+ @attribute = attribute
18
20
 
19
21
  if currencies.respond_to? :each_pair
20
- currencies.each_pair { |key, value| self[key] = value }
22
+ currencies.each_pair { |key, value| @currencies[key.to_s] = value }
21
23
  elsif Recurly.default_currency
22
24
  self[Recurly.default_currency] = currencies
23
25
  else
@@ -34,6 +36,8 @@ module Recurly
34
36
 
35
37
  def []= code, amount
36
38
  currencies[code.to_s] = amount
39
+ @parent.send "#@attribute=", dup if @parent
40
+ amount
37
41
  end
38
42
 
39
43
  # @return [Hash] A hash of currency codes to amounts.
@@ -664,7 +664,7 @@ module Recurly
664
664
  value = fetch_association key, value
665
665
  # FIXME: More explicit; less magic.
666
666
  elsif value && key.end_with?('_in_cents') && !respond_to?(:currency)
667
- value = Money.new value unless value.is_a? Money
667
+ value = Money.new value, self, key unless value.is_a? Money
668
668
  end
669
669
 
670
670
  attributes[key] = value
@@ -208,14 +208,14 @@ module Recurly
208
208
  end
209
209
  @collection.freeze
210
210
  rescue API::NotModified
211
- defined? @collection and @collection or raise
211
+ @collection and @collection or raise
212
212
  end
213
213
 
214
214
  def method_missing name, *args, &block
215
215
  scope = resource_class.scopes[name] and return paginate scope
216
216
 
217
217
  if [].respond_to? name
218
- load! unless defined? @collection
218
+ load! unless @collection
219
219
  return @collection.send name, *args, &block
220
220
  end
221
221
 
@@ -38,6 +38,7 @@ module Recurly
38
38
  created_at
39
39
  details
40
40
  transaction_error
41
+ source
41
42
  )
42
43
  alias to_param uuid
43
44
 
@@ -2,7 +2,7 @@ module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- PATCH = 8
5
+ PATCH = 9
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
data/lib/recurly/xml.rb CHANGED
@@ -38,11 +38,11 @@ module Recurly
38
38
  el = XML.new el
39
39
  case el.name
40
40
  when "number"
41
- text = el.text
41
+ text = el.text.to_s
42
42
  last = text[-4, 4]
43
43
  el.text = "#{text[0, text.length - 4].to_s.gsub(/\d/, '*')}#{last}"
44
44
  when "verification_value"
45
- el.text = el.text.gsub(/\d/, '*')
45
+ el.text = el.text.to_s.gsub(/\d/, '*')
46
46
  end
47
47
  end
48
48
  xml.to_s
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
5
- prerelease:
4
+ version: 2.1.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Recurly
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
11
+ date: 2013-06-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: minitest
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: webmock
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,12 +48,11 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.7.6
62
- description: ! 'An API client library for Recurly: http://recurly.com'
55
+ description: 'An API client library for Recurly: http://recurly.com'
63
56
  email: support@recurly.com
64
57
  executables:
65
58
  - recurly
@@ -103,6 +96,7 @@ files:
103
96
  homepage: https://github.com/recurly/recurly-client-ruby
104
97
  licenses:
105
98
  - MIT
99
+ metadata: {}
106
100
  post_install_message:
107
101
  rdoc_options:
108
102
  - --main
@@ -110,21 +104,19 @@ rdoc_options:
110
104
  require_paths:
111
105
  - lib
112
106
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
107
  requirements:
115
- - - ! '>='
108
+ - - '>='
116
109
  - !ruby/object:Gem::Version
117
110
  version: '0'
118
111
  required_rubygems_version: !ruby/object:Gem::Requirement
119
- none: false
120
112
  requirements:
121
- - - ! '>='
113
+ - - '>='
122
114
  - !ruby/object:Gem::Version
123
115
  version: '0'
124
116
  requirements: []
125
117
  rubyforge_project:
126
- rubygems_version: 1.8.23
118
+ rubygems_version: 2.0.2
127
119
  signing_key:
128
- specification_version: 3
120
+ specification_version: 4
129
121
  summary: Recurly API Client
130
122
  test_files: []