Class: Recurly::Resource

Inherits:
Object
  • Object
show all
Extended by:
Schema::ResourceCaster, Schema::SchemaFactory
Includes:
Schema::SchemaValidator
Defined in:
lib/recurly/resource.rb

Overview

This class represents an object as it exists on the Recurly servers. It is generated from a response. If you wish to update or change a resource, you need to send a request to the server and get a new Resource.

Direct Known Subclasses

Recurly::Resources::Account, Recurly::Resources::AccountAcquisition, Recurly::Resources::AccountAcquisitionCost, Recurly::Resources::AccountBalance, Recurly::Resources::AccountBalanceAmount, Recurly::Resources::AccountMini, Recurly::Resources::AccountNote, Recurly::Resources::AddOn, Recurly::Resources::AddOnMini, Recurly::Resources::AddOnPricing, Recurly::Resources::Address, Recurly::Resources::BillingInfo, Recurly::Resources::BillingInfoUpdatedBy, Recurly::Resources::BinaryFile, Recurly::Resources::Coupon, Recurly::Resources::CouponDiscount, Recurly::Resources::CouponDiscountPricing, Recurly::Resources::CouponDiscountTrial, Recurly::Resources::CouponMini, Recurly::Resources::CouponRedemption, Recurly::Resources::CouponRedemptionMini, Recurly::Resources::CreditPayment, Recurly::Resources::CustomField, Recurly::Resources::CustomFieldDefinition, Recurly::Resources::Empty, Recurly::Resources::Error, Recurly::Resources::ErrorMayHaveTransaction, Recurly::Resources::FraudInfo, Recurly::Resources::Invoice, Recurly::Resources::InvoiceAddress, Recurly::Resources::InvoiceCollection, Recurly::Resources::InvoiceMini, Recurly::Resources::Item, Recurly::Resources::ItemMini, Recurly::Resources::LineItem, Recurly::Resources::LineItemList, Recurly::Resources::Page, Recurly::Resources::PaymentMethod, Recurly::Resources::Plan, Recurly::Resources::PlanHostedPages, Recurly::Resources::PlanMini, Recurly::Resources::PlanPricing, Recurly::Resources::Pricing, Recurly::Resources::Settings, Recurly::Resources::ShippingAddress, Recurly::Resources::ShippingMethod, Recurly::Resources::ShippingMethodMini, Recurly::Resources::Site, Recurly::Resources::Subscription, Recurly::Resources::SubscriptionAddOn, Recurly::Resources::SubscriptionAddOnTier, Recurly::Resources::SubscriptionChange, Recurly::Resources::SubscriptionShipping, Recurly::Resources::TaxInfo, Recurly::Resources::Tier, Recurly::Resources::Transaction, Recurly::Resources::TransactionError, Recurly::Resources::TransactionPaymentGateway, Recurly::Resources::UniqueCouponCode, Recurly::Resources::User

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Schema::ResourceCaster

cast

Methods included from Schema::SchemaValidator

#get_did_you_mean, #validate!, #validate_attribute!

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes


11
12
13
# File 'lib/recurly/resource.rb', line 11

def attributes
  @attributes
end

Instance Method Details

#==(other_resource) ⇒ Object


17
18
19
# File 'lib/recurly/resource.rb', line 17

def ==(other_resource)
  self.attributes == other_resource.attributes
end

#get_responseObject


34
35
36
# File 'lib/recurly/resource.rb', line 34

def get_response
  @response
end

#inspectObject

Hide instance variables to keep from accidental logging


22
23
24
# File 'lib/recurly/resource.rb', line 22

def inspect
  "#<#{self.class.name}:#{object_id}} @attributes=#{attributes}>"
end

#requires_client?Boolean


13
14
15
# File 'lib/recurly/resource.rb', line 13

def requires_client?
  false
end

#to_jsonObject

Raises:

  • (NoMethodError)

30
31
32
# File 'lib/recurly/resource.rb', line 30

def to_json
  raise NoMethodError, "to_json is not implemented for Resources. Please use Resource#attributes"
end

#to_sObject


26
27
28
# File 'lib/recurly/resource.rb', line 26

def to_s
  self.inspect
end