Class: Thron::Gateway::Comment
Constant Summary
collapse
- PACKAGE =
Package.new(:xcontents, :resources, self.service_name)
Constants inherited
from Base
Base::NO_ACTIVE_SESSION
Instance Attribute Summary
Attributes inherited from Base
#token_id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Session
#initialize
Methods included from Pageable
included
Methods inherited from Base
#check_session, client_id, #client_id, service_name
Methods included from Routable
included, info, #route
Class Method Details
.routes ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/thron/gateway/comment.rb', line 11
def self.routes
@routes ||= {
comment_detail: Route::factory(name: 'detail', package: PACKAGE, verb: Route::Verbs::GET),
list_comments: Route::factory(name: 'getComments', package: PACKAGE, verb: Route::Verbs::GET),
insert_comment: Route::factory(name: 'insertComment', package: PACKAGE),
report_comment_abuse: Route::factory(name: 'reportAbuse', package: PACKAGE)
}
end
|
Instance Method Details
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/thron/gateway/comment.rb', line 20
def (options = {})
= options[:comment_id]
query = {
clientId: client_id,
commentId:
}
route(to: __callee__, query: query, token_id: token_id) do |response|
response.body = Entity::Base::factory(response.body.fetch('comment') { {} })
end
end
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/thron/gateway/comment.rb', line 49
def (options = {})
content_id = options[:content_id]
data = options[:data]
category_id = options[:category_id]
body = {
clientId: client_id,
contentId: content_id,
comment: data,
categoryIdForAcl: category_id
}
route(to: __callee__, body: body, token_id: token_id) do |response|
response.body = Entity::Base::factory(response.body.fetch('comment') { {} })
end
end
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/thron/gateway/comment.rb', line 31
def (options = {})
criteria = options.fetch(:criteria) { {} }
locale = options[:locale]
order_by = options[:order_by]
offset = options[:offset].to_i
limit = options[:limit].to_i
order_by = order_by ? { orderBy: order_by } : {}
query = {
clientId: client_id,
locale: locale,
offset: offset,
numberOfResults: limit
}.merge(criteria).merge(order_by)
route(to: __callee__, query: query, token_id: token_id) do |response|
response.body = Entity::Base::factory(response.body.fetch('comments') { [] })
end
end
|
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/thron/gateway/comment.rb', line 64
def (options = {})
= options[:comment_id]
user_id = options[:user_id]
query = {
clientId: client_id,
commentId: ,
userId: user_id
}
route(to: __callee__, query: query, token_id: token_id)
end
|