Class: Amiando::PaymentType
- Inherits:
-
Resource
- Object
- Resource
- Amiando::PaymentType
- Defined in:
- lib/amiando/payment_type.rb
Instance Attribute Summary
Attributes inherited from Resource
#attributes, #request, #response, #success
Class Method Summary (collapse)
-
+ (Object) create(event_id, type)
Create a payment type for an event.
-
+ (PaymentType) find(payment_type_id)
The payment type with that id.
-
+ (Result) find_all_by_event_id(event_id)
With the list of payment types for that event.
Methods inherited from Resource
#==, #[], #extract_attributes_from, #id, #initialize, map, map_params, mapping, #method_missing, method_missing, #populate_create, reverse_map_params, typecasting
Methods included from Autorun
Constructor Details
This class inherits a constructor from Amiando::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Amiando::Resource
Class Method Details
+ (Object) create(event_id, type)
Create a payment type for an event
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/amiando/payment_type.rb', line 20 def self.create(event_id, type) unless type =~ /payment_type_\w+/i type = "payment_type_#{type}" end object = Result.new do |response_body, result| result.errors = response_body['errors'] response_body['id'] || false end post object, "api/event/#{event_id}/paymentType/create", :params => { :type => type.upcase } object end |
+ (PaymentType) find(payment_type_id)
The payment type with that id
60 61 62 63 64 65 66 |
# File 'lib/amiando/payment_type.rb', line 60 def self.find(payment_type_id) object = new get object, "api/paymentType/#{payment_type_id}" object end |
+ (Result) find_all_by_event_id(event_id)
With the list of payment types for that event.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/amiando/payment_type.rb', line 39 def self.find_all_by_event_id(event_id) object = Result.new do |response_body, result| if response_body['success'] response_body['results']['paymentTypes'].map do |payment_type| new(payment_type) end else result.errors = response_body['errors'] false end end get object, "api/event/#{event_id}/paymentTypes" object end |