Class: Thron::Gateway::Delivery
- Defined in:
- lib/thron/gateway/delivery.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
- #content_cuepoints(options = {}) ⇒ Object
- #content_metadata(options = {}) ⇒ Object
- #content_subtitles(options = {}) ⇒ Object
- #content_thumbnail(options = {}) ⇒ Object
- #downloadable_contents(options = {}) ⇒ Object
- #playlist_contents(options = {}) ⇒ Object
- #recommended_contents(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 |
# File 'lib/thron/gateway/delivery.rb', line 11 def self.routes @routes ||= { content_metadata: Route::factory(name: 'getContentDetail', package: PACKAGE, verb: Route::Verbs::GET), content_cuepoints: Route::factory(name: 'getCuePoints', package: PACKAGE, verb: Route::Verbs::GET), downloadable_contents: Route::factory(name: 'getDownloadableContents', package: PACKAGE, verb: Route::Verbs::GET), playlist_contents: Route::factory(name: 'getPlaylistContents', package: PACKAGE, verb: Route::Verbs::GET), recommended_contents: Route::factory(name: 'getRecommendedContents', package: PACKAGE, verb: Route::Verbs::GET), content_subtitles: Route::factory(name: 'getSubTitles', package: PACKAGE, verb: Route::Verbs::GET, accept: Route::Types::PLAIN), content_thumbnail: Route::lazy_factory(name: 'getThumbnail', package: PACKAGE, verb: Route::Verbs::GET) } end |
Instance Method Details
#content_cuepoints(options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/thron/gateway/delivery.rb', line 35 def content_cuepoints( = {}) content_id = [:content_id] criteria = .fetch(:criteria) { {} } offset = [:offset].to_i limit = [:limit].to_i query = { clientId: client_id, xcontentId: content_id, offset: offset, numberOfResult: limit }.merge!(criteria) route(to: __callee__, query: query, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('cuePoints') { [] }) end end |
#content_metadata(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/thron/gateway/delivery.rb', line 23 def ( = {}) content_id = [:content_id] criteria = .fetch(:criteria) { {} } query = { clientId: client_id, xcontentId: content_id }.merge!(criteria) route(to: __callee__, query: query, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body) end end |
#content_subtitles(options = {}) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/thron/gateway/delivery.rb', line 101 def content_subtitles( = {}) content_id = [:content_id] locale = [:locale] criteria = .fetch(:criteria) { {} } query = { clientId: client_id, xcontentId: content_id, locale: locale }.merge!(criteria) route(to: __callee__, query: query, token_id: token_id) end |
#content_thumbnail(options = {}) ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/thron/gateway/delivery.rb', line 113 def content_thumbnail( = {}) content_id = [:content_id] div_area = [:div_area] route(to: __callee__, token_id: token_id, params: [client_id, div_area, content_id]) do |response| response.body = Entity::Base::factory(response.body) end end |
#downloadable_contents(options = {}) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/thron/gateway/delivery.rb', line 51 def downloadable_contents( = {}) content_id = [:content_id] criteria = .fetch(:criteria) { {} } offset = [:offset].to_i limit = [:limit].to_i query = { clientId: client_id, xcontentId: content_id, offset: offset, numberOfResult: limit }.merge!(criteria) route(to: __callee__, query: query, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('contents') { [] }) end end |
#playlist_contents(options = {}) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/thron/gateway/delivery.rb', line 67 def playlist_contents( = {}) content_id = [:content_id] criteria = .fetch(:criteria) { {} } offset = [:offset].to_i limit = [:limit].to_i query = { clientId: client_id, xcontentId: content_id, offset: offset, numberOfResult: limit }.merge!(criteria) route(to: __callee__, query: query, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('contents') { [] }) end end |
#recommended_contents(options = {}) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/thron/gateway/delivery.rb', line 83 def recommended_contents( = {}) content_id = [:content_id] pkey = [:pkey] criteria = .fetch(:criteria) { { admin: true } } offset = [:offset].to_i limit = [:limit].to_i query = { clientId: client_id, xcontentId: content_id, pkey: pkey, offset: offset, numberOfResult: limit }.merge!(criteria) route(to: __callee__, query: query, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('contents') { [] }) end end |