Sha256: 8c0e7efa40783ba39099a134fd07dce418d60f4b18f385694f832ae2ace80142

Contents?: true

Size: 1.19 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
caren-api-0.6.15 lib/caren/store/account_entry.rb