Class: Caren::Store::AccountEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/caren/store/account_entry.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #original_xml

Class Method Summary collapse

Methods inherited from Base

#as_xml, from_xml, hash_from_image, init_dependent_objects, #initialize, #node_root, search_url, #to_xml, to_xml

Constructor Details

This class inherits a constructor from Caren::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Caren::Base

Class Method Details

.all(account_id, session) ⇒ Object



18
19
20
# File 'lib/caren/store/account_entry.rb', line 18

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

.array_rootObject



22
23
24
# File 'lib/caren/store/account_entry.rb', line 22

def self.array_root
  :account_entries
end

.find(account_id, id, session) ⇒ Object



14
15
16
# File 'lib/caren/store/account_entry.rb', line 14

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

.keysObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/caren/store/account_entry.rb', line 3

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

.node_rootObject



26
27
28
# File 'lib/caren/store/account_entry.rb', line 26

def self.node_root
  :account_entry
end

.resource_locationObject



30
31
32
# File 'lib/caren/store/account_entry.rb', line 30

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