recurly 0.1.0 → 0.1.1

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.

data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('recurly', '0.1.0') do |p|
5
+ Echoe.new('recurly', '0.1.1') do |p|
6
6
  p.description = "A Ruby API wrapper for Recurly. Super Simple Subscription billing."
7
7
  p.url = "http://github.com/recurly/recurly-client-ruby"
8
8
  p.author = "Isaac Hall"
@@ -9,5 +9,9 @@ module Recurly
9
9
  def primary_key
10
10
  self.account_code
11
11
  end
12
+
13
+ def to_param
14
+ self.account_code
15
+ end
12
16
  end
13
17
  end
data/lib/recurly/base.rb CHANGED
@@ -5,8 +5,16 @@ require "active_resource"
5
5
  # Errors in Rails 2.3.4 are not parsed correctly.
6
6
  module ActiveResource
7
7
  class Base
8
+ def update_only
9
+ false
10
+ end
11
+
8
12
  def save
9
- save_without_validation
13
+ if update_only
14
+ update
15
+ else
16
+ save_without_validation
17
+ end
10
18
  true
11
19
  rescue ResourceInvalid => error
12
20
  case error.response['Content-Type']
@@ -22,7 +30,7 @@ end
22
30
 
23
31
  module Recurly
24
32
 
25
- VERSION = '0.1.0'
33
+ VERSION = '0.1.1'
26
34
 
27
35
  class << self
28
36
  attr_accessor :username, :password
@@ -65,4 +73,4 @@ module Recurly
65
73
  end
66
74
 
67
75
  end
68
- end
76
+ end
@@ -3,9 +3,8 @@ module Recurly
3
3
  self.element_name = "billing_info"
4
4
  self.prefix = "/accounts/:account_code"
5
5
 
6
- # Create / Update is always a PUT
7
- def save
8
- update
6
+ def update_only
7
+ true
9
8
  end
10
9
  end
11
10
  end
data/lib/recurly/plan.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  module Recurly
2
2
  class Plan < RecurlyBase
3
3
  self.element_name = "plan"
4
+
5
+ def to_param
6
+ self.plan_code
7
+ end
4
8
  end
5
9
  end
@@ -25,15 +25,17 @@ module Recurly
25
25
  def change(timeframe, options = {})
26
26
  raise "Timeframe must be :full or :partial." unless timeframe == 'now' or timeframe == 'renewal'
27
27
  options[:timeframe] = timeframe
28
- connection.put(element_path(:account_code => self.subscription_account_code),
28
+ connection.put(element_path(self.subscription_account_code),
29
29
  self.class.format.encode(options, :root => :subscription),
30
30
  self.class.headers)
31
31
  end
32
32
 
33
33
  def subscription_account_code
34
- acct_code = self.account_code if defined?(self.account_code)
35
- acct_code ||= account.account_code unless account.nil?
34
+ acct_code = self.account_code if defined?(self.account_code) and !self.account_code.nil? and !self.account_code.blank?
35
+ acct_code ||= account.account_code if defined?(account) and !account.nil?
36
36
  acct_code ||= self.primary_key if defined?(self.primary_key)
37
+ acct_code ||= self.id if defined?(self.id)
38
+ raise 'Missing Account Code' if acct_code.nil? or acct_code.blank?
37
39
  acct_code
38
40
  end
39
41
  end
data/recurly.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{recurly}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Isaac Hall"]
9
- s.date = %q{2009-11-22}
9
+ s.date = %q{2010-01-15}
10
10
  s.description = %q{A Ruby API wrapper for Recurly. Super Simple Subscription billing.}
11
11
  s.email = %q{support@recurly.com}
12
12
  s.extra_rdoc_files = ["LICENSE", "README.md", "lib/recurly.rb", "lib/recurly/account.rb", "lib/recurly/base.rb", "lib/recurly/billing_info.rb", "lib/recurly/charge.rb", "lib/recurly/credit.rb", "lib/recurly/plan.rb", "lib/recurly/subscription.rb"]
data/test/account_test.rb CHANGED
@@ -36,10 +36,6 @@ class AccountTest < Test::Unit::TestCase
36
36
  account = create_account('close')
37
37
 
38
38
  account.close_account
39
-
40
- assert_raises ActiveResource::ResourceNotFound do
41
- get_acct = Recurly::Account.find(account.account_code)
42
- end
43
39
  end
44
40
 
45
41
  end
@@ -29,7 +29,8 @@ class SubscriptionTest < Test::Unit::TestCase
29
29
  sub = create_subscription(account, TEST_PLAN_CODE)
30
30
 
31
31
  sub.change('now', :quantity => 2)
32
- sub.reload
32
+
33
+ sub = Recurly::Subscription.find(account.account_code)
33
34
  assert_equal sub.quantity, 2
34
35
  end
35
36
 
data/test/test_helper.rb CHANGED
@@ -17,4 +17,4 @@ def create_account(account_code)
17
17
  :last_name => 'Test',
18
18
  :email => 'verena@test.com',
19
19
  :company_name => 'Recurly Ruby Gem')
20
- end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Hall
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-22 00:00:00 -08:00
12
+ date: 2010-01-15 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15