Class: Thron::Gateway::Content
- Defined in:
- lib/thron/gateway/content.rb
Constant Summary collapse
- PACKAGE =
Package.new(:xcontents, :resources, self.service_name)
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #add_linked_content(options = {}) ⇒ Object
- #add_linked_contents(options = {}) ⇒ Object
- #content_detail(options = {}) ⇒ Object
- #find_contents(options = {}) ⇒ Object
- #move_linked_content(options = {}) ⇒ Object
- #remove_content_for_locale(options = {}) ⇒ Object
- #remove_content_pretty_id(options = {}) ⇒ Object
- #remove_linked_contents(options = {}) ⇒ Object
- #remove_player_embed_code(options = {}) ⇒ Object
- #update_available_solutions(options = {}) ⇒ Object
- #update_content(options = {}) ⇒ Object
- #update_player_embed_codes(options = {}) ⇒ Object
- #update_user_specific_values(options = {}) ⇒ Object
Methods inherited from Session
Methods included from Pageable
Methods inherited from Base
#check_session, client_id, #client_id, service_name
Methods included from Routable
Constructor Details
This class inherits a constructor from Thron::Gateway::Session
Class Method Details
.routes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/thron/gateway/content.rb', line 11 def self.routes @routes ||= { add_content_for_locale: Route::factory(name: 'addContent4Locale', package: PACKAGE), add_content_pretty_id: Route::factory(name: 'addContentPrettyId', package: PACKAGE), add_player_embed_code: Route::factory(name: 'addPlayerEmbedCode', package: PACKAGE), add_linked_content: Route::factory(name: 'addLinkedContent', package: PACKAGE), add_linked_contents: Route::factory(name: 'addLinkedContents', package: PACKAGE), content_detail: Route::factory(name: 'detail', package: PACKAGE, verb: Route::Verbs::GET), find_contents: Route::factory(name: 'findByProperties', package: PACKAGE), move_linked_content: Route::factory(name: 'moveLinkedContent', package: PACKAGE), remove_content_for_locale: Route::factory(name: 'removeContent4Locale', package: PACKAGE), remove_content_pretty_id: Route::factory(name: 'removeContentPrettyId', package: PACKAGE), remove_linked_contents: Route::factory(name: 'removeLinkedContents', package: PACKAGE), remove_player_embed_code: Route::factory(name: 'removePlayerEmbedCode', package: PACKAGE), update_available_solutions: Route::factory(name: 'updateAvailableSolutions', package: PACKAGE), update_content: Route::factory(name: 'updateContent', package: PACKAGE), update_content_for_locale: Route::factory(name: 'updateContent4Locale', package: PACKAGE), update_content_pretty_id: Route::factory(name: 'updateContentPrettyId', package: PACKAGE), update_player_embed_code: Route::factory(name: 'updatePlayerEmbedCode', package: PACKAGE), update_player_embed_codes: Route::factory(name: 'updatePlayerEmbedCodes', package: PACKAGE), update_user_specific_values: Route::factory(name: 'updateUserSpecificValues', package: PACKAGE) } end |
Instance Method Details
#add_linked_content(options = {}) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/thron/gateway/content.rb', line 76 def add_linked_content( = {}) content_id = [:content_id] data = [:data] category_id = [:category_id] body = { clientId: client_id, contentId: content_id, linkedContent: data, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#add_linked_contents(options = {}) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/thron/gateway/content.rb', line 89 def add_linked_contents( = {}) content_id = [:content_id] contents = [:contents] category_id = [:category_id] body = { clientId: client_id, contentId: content_id, linkedContents: { contents: contents }, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#content_detail(options = {}) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/thron/gateway/content.rb', line 104 def content_detail( = {}) content_id = [:content_id] extra = .fetch(:extra) { {} } locale = [:locale] access_key = [:access_key] query = { clientId: client_id, contentId: content_id, locale: locale, pkey: access_key }.merge(extra) route(to: __callee__, query: query, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body) end end |
#find_contents(options = {}) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/thron/gateway/content.rb', line 120 def find_contents( = {}) criteria = .fetch(:criteria) { {} } field_option = .fetch(:field_option) { {} } locale = [:locale] div_area = [:div_area] order_by = [:order_by] offset = [:offset].to_i limit = [:limit].to_i body = { client: { clientId: client_id }, criteria: criteria, contentFieldOption: field_option, locale: locale, divArea: div_area, orderBy: order_by, offset: offset.to_i, numberOfresults: limit.to_i } route(to: __callee__, body: body, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('contents') { [] }) end end |
#move_linked_content(options = {}) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/thron/gateway/content.rb', line 145 def move_linked_content( = {}) content_id = [:content_id] from = [:from].to_i to = [:to].to_i link_type = [:link_type] body = { clientId: client_id, xcontentId: content_id, oldPosition: from.to_i, newPosition: to.to_i, linkType: link_type } route(to: __callee__, body: body, token_id: token_id) end |
#remove_content_for_locale(options = {}) ⇒ Object
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/thron/gateway/content.rb', line 160 def remove_content_for_locale( = {}) content_id = [:content_id] locale = [:locale] query = { clientId: client_id, contentId: content_id, locale: locale } route(to: __callee__, query: query, token_id: token_id) end |
#remove_content_pretty_id(options = {}) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/thron/gateway/content.rb', line 171 def remove_content_pretty_id( = {}) content_id = [:content_id] locale = [:locale] category_id = [:category_id] body = { clientId: client_id, contentId: content_id, locale: locale, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#remove_linked_contents(options = {}) ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/thron/gateway/content.rb', line 184 def remove_linked_contents( = {}) content_id = [:content_id] criteria = .fetch(:criteria) { {} } category_id = [:category_id] body = { clientId: client_id, contentId: content_id, criteria: criteria, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#remove_player_embed_code(options = {}) ⇒ Object
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/thron/gateway/content.rb', line 197 def ( = {}) content_id = [:content_id] player_id = [:player_id] body = { clientId: client_id, contentId: content_id, embedCodeId: player_id } route(to: __callee__, body: body, token_id: token_id) end |
#update_available_solutions(options = {}) ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/thron/gateway/content.rb', line 208 def update_available_solutions( = {}) content_id = [:content_id] solutions = [:solutions].to_a category_id = [:category_id] body = { clientId: client_id, contentId: content_id, contentValues: { availableInSolutions: solutions }, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#update_content(options = {}) ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/thron/gateway/content.rb', line 223 def update_content( = {}) content_id = [:content_id] data = [:data] category_id = [:category_id] body = { clientId: client_id, contentId: content_id, contentValues: data, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#update_player_embed_codes(options = {}) ⇒ Object
236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/thron/gateway/content.rb', line 236 def ( = {}) content_id = [:content_id] players = [:players] category_id = [:category_id] body = { clientId: client_id, contentId: content_id, embedCodes: { embedCodes: players }, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |
#update_user_specific_values(options = {}) ⇒ Object
251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/thron/gateway/content.rb', line 251 def update_user_specific_values( = {}) username = [:username] content_id = [:content_id] data = [:data] category_id = [:category_id] body = { clientId: client_id, username: username, contentId: content_id, contentParams: data, categoryIdForAcl: category_id } route(to: __callee__, body: body, token_id: token_id) end |