Class: Omise::Customer
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from OmiseObject
location, resource
Methods included from Attributes
#[], #as_json, #assign_attributes, #attributes, #destroyed?, #initialize, #key?, #location, #method_missing, #respond_to?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Omise::Attributes
Class Method Details
.create(attributes = {}) ⇒ Object
23
24
25
|
# File 'lib/omise/customer.rb', line 23
def self.create(attributes = {})
new resource(location, attributes).post(attributes)
end
|
.list(attributes = {}) ⇒ Object
19
20
21
|
# File 'lib/omise/customer.rb', line 19
def self.list(attributes = {})
List.new resource(location, attributes).get(attributes)
end
|
.retrieve(id = nil, attributes = {}) ⇒ Object
15
16
17
|
# File 'lib/omise/customer.rb', line 15
def self.retrieve(id = nil, attributes = {})
new resource(location(id), attributes).get(attributes)
end
|
.search ⇒ Object
11
12
13
|
# File 'lib/omise/customer.rb', line 11
def self.search
SearchScope.new(:customer)
end
|
Instance Method Details
#cards(options = {}) ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/omise/customer.rb', line 47
def cards(options = {})
if options.empty?
list_attribute CardList, "cards"
else
response = collection.resource(location("cards")).get(options)
CardList.new(response, parent: self)
end
end
|
#charge(attributes = {}) ⇒ Object
39
40
41
|
# File 'lib/omise/customer.rb', line 39
def charge(attributes = {})
Charge.create(attributes.merge(customer: id))
end
|
#default_card(options = {}) ⇒ Object
43
44
45
|
# File 'lib/omise/customer.rb', line 43
def default_card(options = {})
expand_attribute cards, "default_card", options
end
|
#destroy(attributes = {}) ⇒ Object
35
36
37
|
# File 'lib/omise/customer.rb', line 35
def destroy(attributes = {})
assign_attributes resource(attributes).delete
end
|
#reload(attributes = {}) ⇒ Object
27
28
29
|
# File 'lib/omise/customer.rb', line 27
def reload(attributes = {})
assign_attributes resource(attributes).get(attributes)
end
|
#update(attributes = {}) ⇒ Object
31
32
33
|
# File 'lib/omise/customer.rb', line 31
def update(attributes = {})
assign_attributes resource(attributes).patch(attributes)
end
|