lib/braintree/credit_card.rb in braintree-1.2.1 vs lib/braintree/credit_card.rb in braintree-2.0.0

- old
+ new

@@ -1,6 +1,10 @@ module Braintree + # == More Information + # + # For more detailed documentation on CreditCards, see http://www.braintreepaymentsolutions.com/gateway/credit-card-api + # For more detailed documentation on CreditCard verification, see http://www.braintreepaymentsolutions.com/gateway/credit-card-verification-api class CreditCard include BaseModule # :nodoc: attr_reader :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month, :expiration_year, :last_4, :subscriptions, :token, :updated_at @@ -35,30 +39,30 @@ def self.credit!(token, transaction_attributes) return_object_or_raise(:transaction) { credit(token, transaction_attributes) } end - # Returns a PagedCollection of expired credit cards. + # Returns a ResourceCollection of expired credit cards. def self.expired(options = {}) page_number = options[:page] || 1 response = Http.get("/payment_methods/all/expired?page=#{page_number}") attributes = response[:payment_methods] attributes[:items] = Util.extract_attribute_as_array(attributes, :credit_card).map do |payment_method_attributes| new payment_method_attributes end - PagedCollection.new(attributes) { |page_number| CreditCard.expired(:page => page_number) } + ResourceCollection.new(attributes) { |page_number| CreditCard.expired(:page => page_number) } end - # Returns a PagedCollection of credit cards expiring between +start_date+ and +end_date+ inclusive. + # Returns a ResourceCollection of credit cards expiring between +start_date+ and +end_date+ inclusive. # Only the month and year of the start and end dates are used. def self.expiring_between(start_date, end_date, options = {}) page_number = options[:page] || 1 response = Http.get("/payment_methods/all/expiring?page=#{page_number}&start=#{start_date.strftime('%m%Y')}&end=#{end_date.strftime('%m%Y')}") attributes = response[:payment_methods] attributes[:items] = Util.extract_attribute_as_array(attributes, :credit_card).map do |payment_method_attributes| new payment_method_attributes end - PagedCollection.new(attributes) { |page_number| CreditCard.expiring_between(start_date, end_date, :page => page_number) } + ResourceCollection.new(attributes) { |page_number| CreditCard.expiring_between(start_date, end_date, :page => page_number) } end # Finds the credit card with the given +token+. Raises a NotFoundError if it cannot be found. def self.find(token) response = Http.get "/payment_methods/#{token}"