Sha256: 053c20bf7bd05d0b931c1df489b73a962bfeecea2bab053cad2a870f77275ccf

Contents?: true

Size: 1.18 KB

Versions: 21

Compression:

Stored size: 1.18 KB

Contents

class Caren::Store::AccountEntry < Caren::Base

  def self.keys
    [:id,                   # Integer (Caren id)
     :account_id,           # Integer (Caren account id)
     :amount,               # Integer (Delta amount in credits, unit depends on account billable)
     :reserved,             # Boolean (Is this a reservation?)
     :source_id,            # Integer (Source of the account entry, Caren object id)
     :source_type,          # String (Source of the account entry, Caren object class string)
     :external_source_id    # Integer (Source of the account entry, Your object id, if known)
    ] + super
  end

  def self.find account_id, id, session
    from_xml session.get(self.resource_url(account_id,id))
  end

  def self.all account_id, session
    from_xml session.get(self.resource_url(account_id))
  end

  def self.array_root
    :account_entries
  end

  def self.node_root
    :account_entry
  end

  def self.resource_location
    "/api/pro/store/account/%i/account_entries"
  end

  private

  def resource_url account_id, id=nil
    self.class.resource_url(account_id,id)
  end

  def self.resource_url account_id, id=nil
    "#{self.resource_location % account_id}#{id}"
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
caren-api-0.12.5 lib/caren/store/account_entry.rb
caren-api-0.12.4 lib/caren/store/account_entry.rb
caren-api-0.12.3 lib/caren/store/account_entry.rb
caren-api-0.12.2 lib/caren/store/account_entry.rb
caren-api-0.12.1 lib/caren/store/account_entry.rb
caren-api-0.12.0 lib/caren/store/account_entry.rb
caren-api-0.11.1 lib/caren/store/account_entry.rb
caren-api-0.11.0 lib/caren/store/account_entry.rb
caren-api-0.10.0 lib/caren/store/account_entry.rb
caren-api-0.9.10 lib/caren/store/account_entry.rb
caren-api-0.9.9 lib/caren/store/account_entry.rb
caren-api-0.9.8 lib/caren/store/account_entry.rb
caren-api-0.9.7 lib/caren/store/account_entry.rb
caren-api-0.9.6 lib/caren/store/account_entry.rb
caren-api-0.9.4 lib/caren/store/account_entry.rb
caren-api-0.9.3 lib/caren/store/account_entry.rb
caren-api-0.9.2 lib/caren/store/account_entry.rb
caren-api-0.9.1 lib/caren/store/account_entry.rb
caren-api-0.9.0 lib/caren/store/account_entry.rb
caren-api-0.8.0 lib/caren/store/account_entry.rb