Class: Recurly::Account

Inherits:
Resource show all
Defined in:
lib/recurly/account.rb

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #etag, #response, #uri

Class Method Summary collapse

Methods inherited from Resource

#==, all, associations, belongs_to, #changed, #changed?, #changed_attributes, #changes, collection_name, count, create, create!, define_attribute_methods, #destroy, #destroyed?, embedded!, #errors, find, find_each, first, from_response, from_xml, has_many, has_one, #initialize, #inspect, #marshal_dump, #marshal_load, member_name, member_path, #new_record?, paginate, #persist!, #persisted?, #previous_changes, #read_attribute, reflect_on_association, #reload, resource_name, #save, #save!, scope, scopes, #to_param, #to_xml, #update_attributes, #update_attributes!, #valid?, #write_attribute

Constructor Details

This class inherits a constructor from Recurly::Resource

Class Method Details

.activePager<Account>

Returns A pager that yields active accounts.

Returns:



6
# File 'lib/recurly/account.rb', line 6

scope :active,         :state => :active

.adjustmentsPager<Resource>, []

Returns A pager that yields adjustments for persisted accounts; an empty array otherwise.

Returns:

  • (Pager<Resource>, [])

    A pager that yields adjustments for persisted accounts; an empty array otherwise.



15
# File 'lib/recurly/account.rb', line 15

has_many :adjustments

.billing_infoBillingInfo?

Returns:



21
# File 'lib/recurly/account.rb', line 21

has_one :billing_info, :readonly => false

.closedPager<Account>

Returns A pager that yields closed accounts.

Returns:



7
# File 'lib/recurly/account.rb', line 7

scope :closed,         :state => :closed

.invoice!Invoice

Returns A newly-created invoice.

Returns:

  • (Invoice)

    A newly-created invoice.

Raises:

  • (Invalid)

    Raised if the account cannot be invoiced.



42
43
44
45
46
# File 'lib/recurly/account.rb', line 42

def invoice!
  Invoice.from_response API.post(invoices.uri)
rescue Recurly::API::UnprocessableEntity => e
  raise Invalid, e.message
end

.invoicesPager<Resource>, []

Returns A pager that yields invoices for persisted accounts; an empty array otherwise.

Returns:

  • (Pager<Resource>, [])

    A pager that yields invoices for persisted accounts; an empty array otherwise.



16
# File 'lib/recurly/account.rb', line 16

has_many :invoices

.non_subscriberPager<Account>

Returns A pager that yields non_subscriber accounts.

Returns:

  • (Pager<Account>)

    A pager that yields non_subscriber accounts.



9
# File 'lib/recurly/account.rb', line 9

scope :non_subscriber, :state => :non_subscriber

.past_duePager<Account>

Returns A pager that yields past_due accounts.

Returns:

  • (Pager<Account>)

    A pager that yields past_due accounts.



10
# File 'lib/recurly/account.rb', line 10

scope :past_due,       :state => :past_due

.redemptionRedemption?

Returns:



24
# File 'lib/recurly/account.rb', line 24

has_one :redemption

.reopentrue, false

Reopen an account.

Returns:

  • (true, false)

    true when successful, false when unable to (e.g., the account is already opwn), and may raise an exception if the attempt fails.



53
54
55
56
57
# File 'lib/recurly/account.rb', line 53

def reopen
  return false unless self[:reopen]
  reload self[:reopen].call
  true
end

.subscriberPager<Account>

Returns A pager that yields subscriber accounts.

Returns:

  • (Pager<Account>)

    A pager that yields subscriber accounts.



8
# File 'lib/recurly/account.rb', line 8

scope :subscriber,     :state => :subscriber

.subscriptionsPager<Resource>, []

Returns A pager that yields subscriptions for persisted accounts; an empty array otherwise.

Returns:

  • (Pager<Resource>, [])

    A pager that yields subscriptions for persisted accounts; an empty array otherwise.



17
# File 'lib/recurly/account.rb', line 17

has_many :subscriptions

.transactionsPager<Resource>, []

Returns A pager that yields transactions for persisted accounts; an empty array otherwise.

Returns:

  • (Pager<Resource>, [])

    A pager that yields transactions for persisted accounts; an empty array otherwise.



18
# File 'lib/recurly/account.rb', line 18

has_many :transactions