Sha256: 26732ac5d9f19c33f423806b05c2470d4b1a26288a2e81e268aeb338bbff29e1

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 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)
    ] + 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

5 entries across 5 versions & 1 rubygems

Version Path
caren-api-0.6.14 lib/caren/store/account_entry.rb
caren-api-0.6.13 lib/caren/store/account_entry.rb
caren-api-0.6.12 lib/caren/store/account_entry.rb
caren-api-0.6.11 lib/caren/store/account_entry.rb
caren-api-0.6.10 lib/caren/store/account_entry.rb