Skip to content
This repository

X-Post method error and Rakefile configuration #20

Closed
wants to merge 4 commits into from

2 participants

Eric Lee Isaac Hall
Eric Lee

0ca804d - uses the current instance's base class to find the known_attributes method since it is not present on each instance of the class.

7ebec3d - the configuration is not loaded into Recurly::Base but into a separate hash, so use that hash.

Eric Lee added some commits
Isaac Hall
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 4 unique commits by 1 author.

Mar 18, 2011
Eric Lee If the Recurly::Account class has not yet been loaded, Recurly::Coupo…
…n cannot find the deprecated RecurlyAccountBase class. Switch to using the Recurly::AccountBase class directly.
7362d50
Mar 19, 2011
Eric Lee Use site as read in the Rakefile because Recurly::Base is not configured 7ebec3d
Apr 04, 2011
Eric Lee Merge remote branch 'upstream/master' 524c0d3
Eric Lee The known_attributes method is present on the class, not the instance…
… of the object
0ca804d
This page is out of date. Refresh to see the latest.
2  lib/recurly/base.rb
@@ -92,7 +92,7 @@ def load_attributes_from_response(response)
92 92 def load_errors_from_array(new_errors, save_cache = false)
93 93 errors.clear unless save_cache
94 94 return if new_errors.nil? or new_errors.empty?
95   - humanized_attributes = Hash[self.known_attributes.map { |attr_name| [attr_name.humanize, attr_name] }] unless self.known_attributes.nil?
  95 + humanized_attributes = Hash[self.class.known_attributes.map { |attr_name| [attr_name.humanize, attr_name] }] unless self.class.known_attributes.nil?
96 96 humanized_attributes ||= Hash[@attributes.keys.map { |attr_name| [attr_name.humanize, attr_name] }]
97 97 new_errors.each do |error|
98 98 if error.is_a?(Hash)
2  lib/recurly/coupon.rb
... ... @@ -1,5 +1,5 @@
1 1 module Recurly
2   - class Coupon < RecurlyAccountBase
  2 + class Coupon < AccountBase
3 3 self.element_name = "coupon"
4 4
5 5 def self.known_attributes
4 lib/recurly/rails3/recurly.rake
@@ -38,7 +38,7 @@ namespace :recurly do
38 38
39 39 # now lets clear site data
40 40 begin
41   - RestClient.post( Recurly::Base.site+"/site/test_data",
  41 + RestClient.post( @recurly_config["site"]+"/site/test_data",
42 42 {"_method"=>"delete"},
43 43 :cookies => login_response.cookies)
44 44 raise "Clearing Didn't work for some reason. Is your site setting correct?"
@@ -68,4 +68,4 @@ namespace :recurly do
68 68 # saves the yml file
69 69 Recurly::ConfigParser.save(@recurly_config)
70 70 end
71   -end
  71 +end

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.