Class: Frame::Subscription
Constant Summary
collapse
- OBJECT_NAME =
"subscription"
Instance Attribute Summary
Attributes inherited from FrameObject
#id, #original_values
Class Method Summary
collapse
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
.cancel(id, params = {}, opts = {}) ⇒ Object
70
71
72
73
74
75
76
77
|
# File 'lib/frame/resources/subscription.rb', line 70
def self.cancel(id, params = {}, opts = {})
request_object(
:post,
"/v1/subscriptions/#{CGI.escape(id)}/cancel",
params,
opts
)
end
|
.create(params = {}, opts = {}) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/frame/resources/subscription.rb', line 15
def self.create(params = {}, opts = {})
request_object(
:post,
"/v1/subscriptions",
params,
opts
)
end
|
.list(params = {}, opts = {}) ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/frame/resources/subscription.rb', line 24
def self.list(params = {}, opts = {})
request_object(
:get,
"/v1/subscriptions",
params,
opts
)
end
|
.object_name ⇒ Object
11
12
13
|
# File 'lib/frame/resources/subscription.rb', line 11
def self.object_name
OBJECT_NAME
end
|
.retrieve(id, opts = {}) ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'lib/frame/resources/subscription.rb', line 33
def self.retrieve(id, opts = {})
id = Util.normalize_id(id)
request_object(
:get,
"/v1/subscriptions/#{CGI.escape(id)}",
{},
opts
)
end
|
Instance Method Details
#cancel(params = {}, opts = {}) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/frame/resources/subscription.rb', line 61
def cancel(params = {}, opts = {})
request_object(
:post,
"/v1/subscriptions/#{CGI.escape(self["id"])}/cancel",
params,
opts
)
end
|
#save(params = {}, opts = {}) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/frame/resources/subscription.rb', line 43
def save(params = {}, opts = {})
values = serialize_params(self).merge(params)
if values.empty?
return self
end
updated = request_object(
:patch,
"/v1/subscriptions/#{CGI.escape(self["id"])}",
values,
opts
)
initialize_from(updated)
self
end
|