Class: Caren::Store::Payment

Inherits:
Base
  • Object
show all
Defined in:
lib/caren/store/payment.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, resource_url, #resource_url, 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(session) ⇒ Object



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

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

.all_with_filter(filter, session) ⇒ Object



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

def self.all_with_filter filter, session
  from_xml session.get(self.filter_url(filter))
end

.array_rootObject



34
35
36
# File 'lib/caren/store/payment.rb', line 34

def self.array_root
  :payments
end

.filter_url(filter) ⇒ Object



42
43
44
# File 'lib/caren/store/payment.rb', line 42

def self.filter_url filter
  "#{self.resource_url}?filter=#{filter}"
end

.find(id, session) ⇒ Object



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

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
13
14
15
16
# File 'lib/caren/store/payment.rb', line 3

def self.keys
  [:id,                 # Integer (Caren id)
   :invoice_id,         # Integer (Caren invoice id)
   :person_id,          # Integer (Caren person id)
   :auth_code,          # String
   :psp_reference,      # String
   :refusal_reason,     # String
   :result_code,        # String
   :status,             # String (new, pending,paid,failed)
   :currency,           # String (EUR)
   :amount_in_cents,    # Integer
   :gateway,            # String (ideal)
  ] + super
end

.node_rootObject



38
39
40
# File 'lib/caren/store/payment.rb', line 38

def self.node_root
  :payment
end

.resource_locationObject



46
47
48
# File 'lib/caren/store/payment.rb', line 46

def self.resource_location
  "/api/pro/store/payments"
end

.search(key, value, session) ⇒ Object



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

def self.search key, value, session
  from_xml session.get( self.search_url(key,value) )
end