Coder Social home page Coder Social logo

recurly-client-ruby's Introduction

Recurly

Rubygems Contributor Covenant

This repository houses the official ruby client for Recurly's V3 API.

Note: If you were looking for the V2 client, see the v2 branch.

Reference Documentation

Getting Started Guide and reference documentation can be found on Github Pages.

Contributing

Please see our Contributing Guide.

recurly-client-ruby's People

Contributors

alexfulsome avatar amandamfielding avatar arzitney avatar bdoring avatar bhelx avatar cainj avatar camilopineda100 avatar cbarton avatar chrissrogers avatar csampson avatar csmb avatar cyberxander90 avatar douglaslise avatar douglasmiller avatar drewish avatar efeygelson avatar elepolt avatar eternal44 avatar fabriciocoutinho avatar fkosouski avatar gilv93 avatar isaachall avatar jguidry-recurly avatar joannasese avatar judith avatar malbert avatar patrick-duvall avatar recurly-bearley avatar rer7891 avatar tilley-kyle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recurly-client-ruby's Issues

Add Changelog

Please add a Changelog for the project. It's really difficult to figure out whether I should upgrade otherwise. While I can dig through the entire commit list, that's a pain in the neck at best and I may not totally understand why a change was made.

Documentation Incorrect

In the documentation it says you can use "Recurly.config_via_yaml()". In fact, it's "Recurly.config_from_yaml()". "Recurly.config_from_json()" is available as well, but is not mentioned in the docs. This should be corrected.

Error handling in transparent posts throws an exception in 0.4.10

Whenever a credit card validation through the Transparent API fails, the gem throws the exception:

UsersController# (ArgumentError) "wrong number of arguments (2 for 1)"

/app/.bundle/gems/ruby/1.9.1/gems/recurly-0.4.10/lib/recurly/base.rb:84:in `from_transparent_results'
/app/.bundle/gems/ruby/1.9.1/gems/recurly-0.4.10/lib/recurly/transparent.rb:114:in `rescue in results'
/app/.bundle/gems/ruby/1.9.1/gems/recurly-0.4.10/lib/recurly/transparent.rb:108:in `results'
/app/app/controllers/users_controller.rb:156:in `confirmation'
/app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:150:in `process_action'
/app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:11:in `process_action'
/app/.bundle/gems/ruby/1.9.1/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:18:in `block in process_action'

Looking at the source, looks this line https://github.com/recurly/recurly-client-ruby/blob/master/lib/recurly/transparent.rb#L114 is the culprit, as the second "true" argument seems to not match up to anything.

BillingInfo#valid? should check validity of :credit_card

In certain situations, BillingInfo#valid? will return true even though the underlying credit card is not valid, for instance, billing.info.valid? will return true with the following structure:

# billing.errors.inspect
#<ActiveResource::Errors:0x007ff50ce4fff8 
  @base=#<Recurly::BillingInfo:0x007ff50d2b8b80 
    @attributes={"first_name"=>"Test",
                 "last_name"=>"User",
                 "address1"=>"123 Book St.",
                 "address2"=>"",
                 "city"=>"Denver",
                 "state"=>"CO",
                 "country"=>"US",
                 "zip"=>"80202",
                 "ip_address"=>"127.0.0.1",
                 "credit_card"=>#<Recurly::BillingInfo::CreditCard:0x007ff50d2595e0 
                   @attributes={"number"=>"232482389423423", "year"=>"2011", "month"=>"1", "verification_value"=>"234"}, 
                   @prefix_options={}, 
                   @persisted=false, 
                   @errors=#<ActiveResource::Errors:0x007ff50ce41ca0 
                     @base=#<Recurly::BillingInfo::CreditCard:0x007ff50d2595e0 ...>, 
                     @messages={:number=>["credit card number is not a valid credit card number"], 
                                :year=>["must be in the future"]}
                 >>
                }, 
    @prefix_options={:account_code=>2},
    @persisted=false,
    @errors=#<ActiveResource::Errors:0x007ff50ce4fff8 ...>>,
    @messages={}
>

billing.valid? #=> true
billing.credit_card.valid? #=> false

Therefore, BillingInfo#valid? should check self.errors.blank? as well as self.credit_card.errors.blank?

I'm on Ruby 1.9.2p290, Rails 3.1.0 and Recurly 0.4.12

undefined method `sign_subscription' for Recurly.js:Module

I was having this error while trying to migrate to Recurly js v2 and therefore, having to add signatures to my requests.

I fixed this error by replacing this line:
gem 'recurly', '~> 2.0.10'

with this one:
gem 'recurly', :git => 'https://github.com/recurly/recurly-client-ruby.git', :branch => 'master'

Recurly::Subscription should catch invalid dates

Recurly will raise a 500 when invalid dates are used. For example, setting a :trial_expires_at value in the past will result in a 500 (and a not so helpful error message). Since these types of things can be caught before ever hitting the server, it'd be nice if a local validation raised a pertinent error message.

Updating trial subscription

After this big API rewrite, is there still no way to change a subscription while it's in trial without it instantly billing the client?

Changelog

Could you guys start keeping a Changelog or history file? It's hard to pull out the major changes from one version to the next by reading commits or compare views.

Subscription add-ons caching prevents updating add-ons

You cannot update subscription add-ons after you have read them. E.g.:

# Read add-ons.
subscription.subscription_add_ons

# Update add-ons.
subscription.attributes = { plan_code: '...', timeframe: 'now', :subscription_add_ons => [...] }

# Read add-ons
subscription.subscription_add_ons

Expected Result:
The newly updated add-ons are returned.

Actual Result:
The original add-ons are returned.

This results in the following error when trying to update add-ons after reading them:

subscription.subscription_add_ons
subscription.update_attributes(plan_code: '...', timeframe: 'now', :subscription_add_ons => [...])

=> `Recurly::API::BadRequest: The provided XML was invalid. Tag <unit_amount_in_cents> must contain only text`

That's because of another bug in the Resource#to_xml when trying to generate xml from the add-ons array.

This bug is caused by over-eager caching in the ruby-client. See Recurly::Subscription#subscription_add_ons. You are caching the result in @subscription_add_ons, however this cache is not cleared when the value is updated...

A quick fix would be to update the instance variable in the Recurly::Subscription#subscription_add_ons= method.

Invalid xml generated by to_xml

Code

Recurly::Account.new(:account_code => 'code').to_xml

Expected result

"<account><account_code>code</account_code></account>"

Actual result

"<account><account_code><account_code>code</account_code></account_code></account>"

Error to get the Invoice list

Hi all,

I have problem with this gem.
I can not to get the invoice list. I'm not sure why, it have worked before.

invoices = Recurly::Invoice.list("account_code")
ArgumentError: expected an attributes Hash, got ""
/app/.bundle/gems/ruby/1.9.1/gems/recurly-0.4.3/lib/recurly/base.rb:50:in `load'

There is something wrong with my code?
Please let me know any thought about this.
Thanks.

Cannot create plan with recurly 2.0.x on Rails 3.0 & 3.1

This piece of code failed miserably on our end:
plan = Recurly::Plan.create(
:plan_code => "gold",
:name => "The Gold Plan",
:unit_amount_in_cents => 79_00
)

Here is the back trace:

NoMethodError: undefined method instruct!' for <unit_amount_in_cents/>:Recurly::XML from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/activesupport-3.1.1/lib/active_support/core_ext/hash/conversions.rb:78:into_xml'
from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/money.rb:93:in method_missing' from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:687:inblock in to_xml'
from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:682:in each' from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:682:into_xml'
from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:718:in save' from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:336:inblock in create'
from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:540:in initialize' from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:336:innew'
from /Users/eastagile3/.rvm/gems/ruby-1.9.3-p0@bullseyehub/gems/recurly-2.0.3/lib/recurly/resource.rb:336:in `create'

Here is my Gemfile:

source :rubygems

gem 'bundler', '>= 1.0.15'
gem 'rake', '> 0.9.2'
gem 'rails', '3.1.1'
gem 'mysql2', '
> 0.3'
gem 'settingslogic'

This is loaded by Rake thanks to Rails.

gem 'rdoc'

gem 'hoptoad_notifier'

Dependencies for BackgrounDrb

gem 'chronic', '0.2.3'
gem 'packet', '0.1.7'

gem 'selenium-client', '1.2.18'
gem 'nokogiri'
gem 'fast_xs'
gem 'xml-simple', '1.0.12', :require => 'xmlsimple'
gem 'json'
gem 'oauth', '0.3.6'
gem 'dalli', '> 1.0.4'
gem 'premailer'
gem 'newrelic_rpm', '
> 3.1'
gem 'bitly', '0.5.0'

gem 'aws-s3'
gem 'paperclip', '~> 2.4'

gem 'haml', '~> 3.1.2'
gem 'rails_autolink'

gem 'therubyracer', '0.9.4'

gem 'formtastic', '> 2'
gem 'will_paginate', '
> 3'
gem 'simple-navigation', '~> 3.5'

gem 'paypal', '2.0.0'
gem 'recurly'
gem 'delayed_job', '~> 2.1'
gem 'net-ssh', '2.0.23', :require => 'net/ssh'
gem 'net-scp', '1.0.4', :require => 'net/scp' # Requires net-ssh
gem 'spreadsheet', '0.6.5.0'
gem 'rubyzip', '0.9.4', :require => 'zip/zip'
gem 'prawn', '0.8.4'
gem 'mime-types', '1.16', :require => 'mime/types'
gem 'mechanize', '1.0.0'
gem 'simple-rss', '1.2.3'
gem 'rest-client'
gem 'amatch'

gem 'geokit', '~> 1.6'
gem 'geokit-rails3'

gem 'tinymce-rails'

gem 'sunspot_rails'

gem 'uuid'

gem 'aws'
gem 'resque'

group :assets do
gem 'sass-rails', '> 3.1.0'
gem 'coffee-rails', '
> 3.1.0'
gem 'uglifier'
gem 'compass', '~> 0.12.alpha'
gem 'uglifier'
end

gem 'jquery-rails'
gem 'dynamic_form'
gem 'devise'

group :development do
gem 'awesome_print', :require => 'ap'
gem 'haml-rails'
end

group :development, :test do
gem 'rspec-rails', '>= 2.6'
gem 'pickle'
gem 'pry'
gem 'ruby-debug-base19', '0.11.26'
gem 'ruby-debug19', '0.11.6'
gem 'linecache19', '0.5.13'
end

gem 'faker', :group => [:development, :test]

group :test do
gem 'cucumber-rails', '>= 1.1.1', require: nil
gem 'resque_spec'

Use the latest version of Spork

https://github.com/timcharper/spork/issues/37

gem 'spork', '>= 0.9.0.rc9'

gem 'simplecov'
gem 'shoulda-matchers', '>= 1.0.0.beta2'
gem 'capybara'
gem 'webmock'
gem 'vcr'
gem 'machinist', git: 'git://github.com/notahat/machinist.git'

Require launchy so cucumber steps can open the current page in a browser

gem 'launchy', '2.0.3'

gem 'database_cleaner'
gem 'timecop', '0.3.5'
gem 'sunspot_test'
end

group :shell do
gem 'guard-rspec', '>= 0.3.1'
gem 'guard-cucumber', '>= 0.3.2'
gem 'guard-spork', '>= 0.1.10'
gem 'rb-fsevent'

html2haml requires erubis

gem 'erubis'

Required by bundle viz

gem 'ruby-graphviz'
end

Better expose transaction errors

Transaction errors are currently only accessible when they are thrown or by
calling transaction[:transaction_error] on a record fetched from the API.

The Recurly::Subscription#change method should update state value

If a subscription is in a 'canceled' state and the Recurly::Subscription#change method is called, such that it would reactivate a subscription, the local subscription state value is still 'canceled'. It'd be nice if the change method parsed the return response and updated local values accordingly. Otherwise an additional call to refresh the subscription is required.

Problem with Addons

Hey,

I just upgraded my version of this gem, and I'm suddenly receiving an error when saving a subscription with addons.

undefined method `invalid!' for {"add_on_code"=>"my_addon_name"}:Hash

Any ideas? Thanks,

Forrest

Can't set description on Coupon

I don't seem to be able to set the invoice description when I create coupons. It seems that maybe there's a mismatch between the Ruby library and the Recurly backend. The Coupon object in the API documentation says to set an invoice_description attribute (https://docs.recurly.com/api/coupons), while the Ruby library code uses a description attribute (https://github.com/recurly/recurly-client-ruby/blob/master/lib/recurly/coupon.rb#L27). Neither of the attributes seems to work.

Subscription creation fails with a valid coupon_code parameter

This does not work:

  params.merge!(:coupon_code => 'a_valid_coupon_code')
  subscription = Recurly::Subscription.create!(params)

This works:

  account = Recurly::Account.find('a_valid_user')
  coupon = Recurly::Coupon.find('a_valid_coupon_code')
  coupon.redeem(account)
  subscription = Recurly::Subscription.create!(params)

Not sure why this is happening or if this is an issue with the API itself or with this gem. The first block returns an invalid coupon code error, the second does not.

Doc updates for http://docs.recurly.com/api/plans

Could you update the "Update Plan" section for ruby on the http://docs.recurly.com/api/plans.

It shows an example like:

plan.setup_fee_in_cents['EUR'] = 50_00 which didn't work for me. Instead this is what did

plan.setup_fee_in_cents = { 'EUR' => 5000 }

Not sure who owns the docs for the Recurly main site, just thought i would post here so you would have the info. Also you do 50_00 in the docs and that doesn't seem valid since the api expects an integer.

Thanks,

Dan

Marshalling objects

In our project we want to cache the product plans from the recurly service. As a first solution we wanted to put the result into the rails cache like the following:

Rails.cache.fetch("recurly_plan_all", :expires_in => 3.hours) do
  Recurly::Plan.all
end

This approach results in the following error:

TypeError: can't dump hash with default proc

Are there any suggestions how to solve this problem like providing custom marshal_dump and marshal_load methods?

Error getting an account's transactions

I'm able to successfully get an Account and it's invoices but when I attempt to get it's transactions, I get this:

irb(main):023:0> account_code = "XYZ"
=> "XYZ"

irb(main):026:0> account = Recurly::Account.find(account_code)
=> [all good here]

irb(main):027:0> account.invoices
=> [all good here]

irb(main):028:0> account.transactions
ArgumentError: wrong number of arguments (0 for 1)
from /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/memoizable.rb:88:in _unmemoized_transactions' from /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/memoizable.rb:88:intransactions'
from (irb):28

Problem creating subscription with SubscriptionAddOn objects

SubscriptionAddOn objects can no longer be used to create a subscription. Only an array of add on codes is accepted. This is most likely due to the way add-ons are now being instantiated on the Subscription object due to commit 0aa5a6f from issue #70.

plan = Recurly::Plan.find('small-plan')

# doesn't work anymore
subscription = Subscription.create!(
  account:   billing_info.account,
  plan_code: plan.plan_code,
  add_ons:   plan.add_ons
)

# work-around:
subscription = Subscription.create!(
  account:   billing_info.account,
  plan_code: plan.plan_code,
  add_ons:   plan.add_ons.map(&:add_on_code)
)

This also means that updating the amount_in_cents of an add-on isn't fully supported anymore.

1.9.3 scoping issue

when using with ruby 1.9.3, I am now getting a ton of these warnings with my rspec output:

recurly-client-ruby-1ec401050563/lib/recurly/resource.rb:267: warning: toplevel constant Scopes referenced by Recurly::Account::Scopes

subscription.change fails when account_code is a number

Inside the subscription.change() method, CGI::escape throws an error when passed a number (Fixnum, etc). The line below should read:

path = "/accounts/#{CGI::escape(self.subscription_account_code.to_s || '')}/subscription.xml"

Recurly::Account.find -- error on account codes containing spaces

Fixed using

Recurly::Account.find URI.escape(@subscription.account_code)

but it would be nice if the recurly gem helped you out with that. (I shouldn't have to know about the internal workings, or especially have to modify my code based on the fact that you pass the account code directly as a URL fragment)

Getting "Recurly::ConfigurationError: Recurly.api_key not configured" error

I'm getting a configuration error when I'm providing my Recurly credentials as mentioned in the README file using rails 3.1:

/config/initializers/recurly.rb

Recurly.api_key = ENV['RECURLY_API_KEY']
Recurly.js.private_key = ENV['RECURLY_JS_PRIVATE_KEY']

This is the error I'm getting: Recurly::ConfigurationError: Recurly.api_key not configured

When I provide a string instead of using the ENV array, everything works fine...

/config/initializers/recurly.rb

Recurly.api_key = 'RECURLY_API_KEY'
Recurly.js.private_key = 'RECURLY_JS_PRIVATE_KEY'

Did you guys make a mistake in the README file? Or is it supposed to work this way?

Thanks
LP

incorrect use of logger in base.rb

I am running into this error only when i am using the production recurly environment (my gateway - auth.net - is in test mode).

NoMethodError (private method warn' called for nil:NilClass): 2011-09-17T23:53:53+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/recurly-0.4.11/lib/recurly/base.rb:103:inrescue in load_errors'

Looking at the code, it appears logger.warn is used in the file without ever instantiating logger. Just a guess but in any case, this error causes my app to crash when using production credentials only - not the sandbox.

BillingInfo::New

First, just wanted to say thanks for this. The gem was working great for v1, just had a question about the v2 setup.

I'm trying to use the jsv2 branch so I can use the new Recurly API and am having an issue everytime I use:

Recurly::BillingInfo.new

I get:

private method `new' called for Recurly::BillingInfo:Class

Is there a new way that's done in this setup?

I'm using Rails 3.2.1 and ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0].

Thanks!

Error handling appears broken in 0.4.8

Hi,

we noticed that in v0.4.8 the error handling appears to be broken. I've included below some example code which reproduces the problem. It works ok in v0.4.2 (although for some reason the error message came out in french for me).

details = {
  :account_code => 'ac1',
  :first_name => 'John',
  :last_name => 'Doe',
  :email => '[email protected]',
  :username => '[email protected]'
}
account = Recurly::Account.new(details)
account.billing_info = Recurly::BillingInfo.new(
  :account_code => account.account_code,
  :first_name => account.first_name,
  :last_name => account.last_name,
  :address1 => '123 Test St',
  :city => 'San Francisco',
  :state => 'CA',
  :zip => '94115',
  :credit_card => {
    :number => '4111-1111-1111-1111',
    :year => Time.now.year + 1,
    :month => Time.now.month,
    :verification_value => '123'
  }
)
subscription = Recurly::Subscription.create(
  :account_code => details[:account_code],
  :plan_code => 'lbm',
  :account => account,
  :coupon_code => 'does-not-exist'
)

Expected output

irb(main):033:0* p subscription.errors
{:base=>["Le Subscriptions n'est pas valide", "Le Coupon code n'est pas valide"]}
=> {:base=>["Le Subscriptions n'est pas valide", "Le Coupon code n'est pas valide"]}

Actual

irb(main):163:0* p subscription.errors
{}
=> {}

Invalid signature generated when including add_ons

I'm using RecurlyJS and am trying to include the details of my add-ons when generating a subscription signature. Basically, the signature generation code looks like this:

Recurly.js.sign(
:account => { :account_code => "example" },
:subscription => {
:plan_code => "example",
:add_ons => [
{ :add_on_code => "example1",
:quantity => 10 },
{ :add_on_code => "example2",
:quantity => 10 },
]
}
)

The output of that is:

"db88b8cae22d82f3bb1ab28ec719389f0c61da46|account%5Baccount_code%5D=example&nonce=fcM4WDIFVrte66IqGfIgVlaarDvr981leTMwVYWxeUQ&subscription%5Badd_ons%5D%5B%5D%5Badd_on_code%5D=example1&subscription%5Badd_ons%5D%5B%5D%5Bquantity%5D=10&subscription%5Badd_ons%5D%5B%5D%5Badd_on_code%5D=example2&subscription%5Badd_ons%5D%5B%5D%5Bquantity%5D=10&subscription%5Bplan_code%5D=example&timestamp=1331709156"

When that gets posted to the API, the API returns an internal server error. I've verified that the problem is indeed the signature, as the submission goes through correctly when I take the add-on portion out of the signature. The subscription gets successfully created with the add-ons I'm defining in the submission.

I haven't found any examples of including the add-on details in the signature, so perhaps it's just not fully supported. I would think it would need to be to ensure the user doesn't fake any of the values before submission. I know I could verify the data after the subscription has been created, but it would be much cleaner if I could do it earlier in the flow.

Any help would be greatly appreciated!

undefined method `from_xml' when retrieving existing Account

I am getting the following error when trying to retrieve an existing account:

NoMethodError: undefined method `from_xml' for #<Class:0x007f9d6da5be20>
  from /Users/lucasefe/Programming/work/seba/southdoctors/.gs/gems/activerecord-3.1.0/lib/active_record/base.rb:1082:in `method_missing'
  from /Users/lucasefe/Programming/work/seba/southdoctors/.gs/gems/recurly-2.1.2/lib/recurly/xml.rb:23:in `cast'
  from /Users/lucasefe/Programming/work/seba/southdoctors/.gs/gems/recurly-2.1.2/lib/recurly/resource.rb:417:in `block in from_xml'
  from /Users/lucasefe/Programming/work/seba/southdoctors/.gs/gems/recurly-2.1.2/lib/recurly/xml/rexml.rb:17:in `block in each_element'
  from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/1.9.1/rexml/element.rb:905:in `block in each'
  from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/1.9.1/rexml/xpath.rb:67:in `each'
  from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/1.9.1/rexml/xpath.rb:67:in `each'
  from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/1.9.1/rexml/element.rb:905:in `each'
  from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/1.9.1/rexml/element.rb:393:in `each_element'

The code I'm executing is very simple:

Recurly::Account.find("some_code")

For what I saw, the returned status element does not include a type attribute, so the Recurly::XML class is trying to do some magic.

Any idea? Anything will be helpful.

Thanks

Validation errors should match local field names

The validation errors returned on BillingInformation and CreditCard are of marginal value because they're all added to base and use unfriendly names like billing info.address1. It looks like you're relying on the default behavior in ActiveResource for translating error XML into validation error messages. It'd be nice if the client added some extra logic and added the errors to the correct fields. This would grossly simply form validations with the Recurly client.

Subscription#all does not return all records as expected, only the first page

This is more of a design issue than a bug in particular. The Subscription#all method doesn't return all records as expected, but only the first 50. I expect this is a problem across all resources.

We've changed to use the find_each method, but I suggest we remove Resource#all unless it can act as expected.

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Hi,

Running Ruby 1.9.2-p290.

I'm getting this error:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Raised from:
/usr/lib/ruby/1.9.1/net/http.rb, line 678

The issue is that the net http instance is not configured with the path to my local SSL certificates, hence it is failing to verify the peer SSL certificate.

The problem stems from lib/recurly/api/net_http.rb which does not permit additional options to be set on the Net::HTTP object instance prior to the http.start method call.

For an example and further details of this issue, also see:
http://martinottenwaelter.fr/2010/12/ruby19-and-the-ssl-error/
https://github.com/technoweenie/faraday/pull/51 (totally different lib, but issue is the same)

Please can some kind of interface be added to the Recurly client that will permit correct setup of the net http object prior to http.start?

Many thanks,

Jason

Subscription Deletion

Hey,

I don't know if this is the API or the gem, but I can't destroy a subscription. I get a Recurly::Resource::NotFound error. The subscription definitely exists.

Forrest

BUG: subscription.change fails

When I try to use subscription.change, such as

  subscription.change('now', :quantity => 4)

it crashes with the following:

  NoMethodError (undefined method `each' for "4":String):
  recurly (0.1.3) lib/recurly/base.rb:63:in `element_path'
  recurly (0.1.3) lib/recurly/subscription.rb:28:in `change'

Recurly::Account.list not working

Recurly::Account.list and .find(:all) returns an empty array while obviously I have an active account: http://d.pr/evAh

Everything is working on "test" recurly environment

ruby-1.8.7-p302 > Recurly::Account.find :all
 => [] 

Asking for certain account finds it:

ruby-1.8.7-p302 > Recurly::Account.find 14
 => #<Recurly::Account:0x1054e8ad0 @prefix_options={}, @attributes={"created_at"=>Thu Oct 28 13:57:59 UTC 2010...

Updating a Subscription's Add Ons

If you update a subscription like so:

subscription.update_attributes (
  :timeframe => 'now'
  :subscription_add_ons => {
    :add_on_code=>'add-on-code'
  }
)

It fails on line 35 of the recurly helper with 'each_pair' method. This is because [:add_on_code, "add-on-code"] is getting passed as an array instead of [{:add_on_code, "1944"}].

The short method,

subscription.add_ons << {:add_on_code => 'add-on-code'}
subscription.save

seems to work just fine.

Update builder dependency

Hello,
I was investigating while in my Rails project I couldn't update gems anymore through bundler.

After some debugging it seems Recurly is the culprit:

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    recurly depends on
      activesupport (= 2.3.0)

    recurly depends on
      activesupport (3.0.3)

Bundler could not find compatible versions for gem "builder":
  In Gemfile:
    recurly depends on
      builder (~> 2.1.2)

    hoptoad_notifier depends on
      builder (3.0.0)

It would be nice to upgrade the Builder dependency to something more recent: http://rubygems.org/gems/builder/versions

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.