Sha256: 34516622c33f3c3c6bc39e3729f5a938d05678ce13e06e5b35fd9c454d0da12b

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 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

3 entries across 3 versions & 1 rubygems

Version Path
caren-api-0.6.18 lib/caren/store/account_entry.rb
caren-api-0.6.17 lib/caren/store/account_entry.rb
caren-api-0.6.16 lib/caren/store/account_entry.rb