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::AddressWithName, Recurly::Resources::BillingInfo, Recurly::Resources::BillingInfoUpdatedBy, Recurly::Resources::BinaryFile, Recurly::Resources::BusinessEntity, 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::CustomerPermission, Recurly::Resources::DunningCampaign, Recurly::Resources::DunningCampaignsBulkUpdateResponse, Recurly::Resources::DunningCycle, Recurly::Resources::DunningInterval, Recurly::Resources::Empty, Recurly::Resources::Entitlement, Recurly::Resources::Entitlements, Recurly::Resources::Error, Recurly::Resources::ErrorMayHaveTransaction, Recurly::Resources::ExportDates, Recurly::Resources::ExportFile, Recurly::Resources::ExportFiles, Recurly::Resources::ExternalAccount, Recurly::Resources::ExternalCharge, Recurly::Resources::ExternalInvoice, Recurly::Resources::ExternalPaymentPhase, Recurly::Resources::ExternalProduct, Recurly::Resources::ExternalProductReferenceCollection, Recurly::Resources::ExternalProductReferenceMini, Recurly::Resources::ExternalSubscription, Recurly::Resources::FraudInfo, Recurly::Resources::FraudRiskRule, Recurly::Resources::GatewayAttributes, Recurly::Resources::GeneralLedgerAccount, Recurly::Resources::GiftCard, Recurly::Resources::GiftCardDelivery, Recurly::Resources::GrantedBy, Recurly::Resources::Invoice, Recurly::Resources::InvoiceAddress, Recurly::Resources::InvoiceCollection, Recurly::Resources::InvoiceMini, Recurly::Resources::InvoiceTemplate, Recurly::Resources::Item, Recurly::Resources::ItemMini, Recurly::Resources::LineItem, Recurly::Resources::MeasuredUnit, Recurly::Resources::Page, Recurly::Resources::PaymentMethod, Recurly::Resources::PercentageTier, Recurly::Resources::PercentageTiersByCurrency, Recurly::Resources::PerformanceObligation, Recurly::Resources::Plan, Recurly::Resources::PlanHostedPages, Recurly::Resources::PlanMini, Recurly::Resources::PlanPricing, Recurly::Resources::PlanRampInterval, Recurly::Resources::PlanRampPricing, 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::SubscriptionAddOnPercentageTier, Recurly::Resources::SubscriptionAddOnTier, Recurly::Resources::SubscriptionChange, Recurly::Resources::SubscriptionChangeBillingInfo, Recurly::Resources::SubscriptionRampIntervalResponse, Recurly::Resources::SubscriptionShipping, Recurly::Resources::TaxDetail, Recurly::Resources::TaxInfo, Recurly::Resources::Tier, Recurly::Resources::TierPricing, Recurly::Resources::Transaction, Recurly::Resources::TransactionError, Recurly::Resources::TransactionFraudInfo, Recurly::Resources::TransactionPaymentGateway, Recurly::Resources::UniqueCouponCode, Recurly::Resources::UniqueCouponCodeParams, Recurly::Resources::Usage, 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
20
# File 'lib/recurly/resource.rb', line 17

def ==(other_resource)
  other_resource.is_a?(Recurly::Resource) &&
    attributes == other_resource.attributes
end

#get_responseObject



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

def get_response
  @response
end

#inspectObject

Hide instance variables to keep from accidental logging



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

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

#requires_client?Boolean

Returns:

  • (Boolean)


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

def requires_client?
  false
end

#to_jsonObject

Raises:

  • (NoMethodError)


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

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

#to_sObject



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

def to_s
  self.inspect
end