Class: Frame::Customer
Constant Summary
collapse
- OBJECT_NAME =
"customer"
Instance Attribute Summary
Attributes inherited from FrameObject
#id, #original_values
Class Method Summary
collapse
-
.block(id, params = {}, opts = {}) ⇒ Object
-
.create(params = {}, opts = {}) ⇒ Object
-
.delete(id, params = {}, opts = {}) ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
-
.object_name ⇒ Object
-
.payment_methods(id, opts = {}) ⇒ Object
-
.retrieve(id, opts = {}) ⇒ Object
-
.search(params = {}, opts = {}) ⇒ Object
-
.unblock(id, params = {}, opts = {}) ⇒ Object
Instance Method Summary
collapse
create
list
#serialize_params
Methods inherited from APIResource
class_name, #refresh, resource_url, #resource_url
included
Methods inherited from FrameObject
#[], #[]=, construct_from, #each, #initialize, #initialize_from, #inspect, #keys, #serialize_params, #to_hash, #to_s, #update_attributes, #values
Class Method Details
.block(id, params = {}, opts = {}) ⇒ Object
71
72
73
74
75
76
77
78
|
# File 'lib/frame/resources/customer.rb', line 71
def self.block(id, params = {}, opts = {})
request_object(
:post,
"/v1/customers/#{CGI.escape(id)}/block",
params,
opts
)
end
|
.create(params = {}, opts = {}) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/frame/resources/customer.rb', line 16
def self.create(params = {}, opts = {})
request_object(
:post,
"/v1/customers",
params,
opts
)
end
|
.delete(id, params = {}, opts = {}) ⇒ Object
53
54
55
56
57
58
59
60
|
# File 'lib/frame/resources/customer.rb', line 53
def self.delete(id, params = {}, opts = {})
request_object(
:delete,
"/v1/customers/#{CGI.escape(id)}",
params,
opts
)
end
|
.list(params = {}, opts = {}) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/frame/resources/customer.rb', line 25
def self.list(params = {}, opts = {})
request_object(
:get,
"/v1/customers",
params,
opts
)
end
|
.object_name ⇒ Object
12
13
14
|
# File 'lib/frame/resources/customer.rb', line 12
def self.object_name
OBJECT_NAME
end
|
.payment_methods(id, opts = {}) ⇒ Object
98
99
100
101
102
103
104
105
|
# File 'lib/frame/resources/customer.rb', line 98
def self.payment_methods(id, opts = {})
request_object(
:get,
"/v1/customers/#{CGI.escape(id)}/payment_methods",
{},
opts
)
end
|
.retrieve(id, opts = {}) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/frame/resources/customer.rb', line 34
def self.retrieve(id, opts = {})
id = Util.normalize_id(id)
request_object(
:get,
"/v1/customers/#{CGI.escape(id)}",
{},
opts
)
end
|
.search(params = {}, opts = {}) ⇒ Object
44
45
46
47
48
49
50
51
|
# File 'lib/frame/resources/customer.rb', line 44
def self.search(params = {}, opts = {})
request_object(
:get,
"/v1/customers/search",
params,
opts
)
end
|
.unblock(id, params = {}, opts = {}) ⇒ Object
89
90
91
92
93
94
95
96
|
# File 'lib/frame/resources/customer.rb', line 89
def self.unblock(id, params = {}, opts = {})
request_object(
:post,
"/v1/customers/#{CGI.escape(id)}/unblock",
params,
opts
)
end
|
Instance Method Details
#block(params = {}, opts = {}) ⇒ Object
62
63
64
65
66
67
68
69
|
# File 'lib/frame/resources/customer.rb', line 62
def block(params = {}, opts = {})
request_object(
:post,
"/v1/customers/#{CGI.escape(self["id"])}/block",
params,
opts
)
end
|
#delete(params = {}, opts = {}) ⇒ Object
125
126
127
128
129
130
131
132
|
# File 'lib/frame/resources/customer.rb', line 125
def delete(params = {}, opts = {})
request_object(
:delete,
"/v1/customers/#{CGI.escape(self["id"])}",
params,
opts
)
end
|
#save(params = {}, opts = {}) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/frame/resources/customer.rb', line 107
def save(params = {}, opts = {})
values = serialize_params(self).merge(params)
if values.empty?
return self
end
updated = request_object(
:patch,
"/v1/customers/#{CGI.escape(self["id"])}",
values,
opts
)
initialize_from(updated)
self
end
|
#unblock(params = {}, opts = {}) ⇒ Object
80
81
82
83
84
85
86
87
|
# File 'lib/frame/resources/customer.rb', line 80
def unblock(params = {}, opts = {})
request_object(
:post,
"/v1/customers/#{CGI.escape(self["id"])}/unblock",
params,
opts
)
end
|