Class: Thron::Gateway::PublishingProcess

Inherits:
Session
  • Object
show all
Defined in:
lib/thron/gateway/publishing_process.rb

Constant Summary collapse

PACKAGE =
Package.new(:xadmin, :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

Constructor Details

This class inherits a constructor from Thron::Gateway::Session

Class Method Details

.routesObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/thron/gateway/publishing_process.rb', line 9

def self.routes
  @routes ||= {
    change_channel_status: Route::factory(name: 'changeChannelStatus', package: PACKAGE), 
    create_content_for_channel: Route::factory(name: 'createContentForChannel', package: PACKAGE),
    get_content_types: Route::factory(name: 'getContentTypes', package: PACKAGE),
    new_content: Route::factory(name: 'newContent', package: PACKAGE),
    new_live_event_content: Route::factory(name: 'newLiveEventContent', package: PACKAGE),
    new_pagelet_content: Route::factory(name: 'newPageletContent', package: PACKAGE),
    new_playlist_content: Route::factory(name: 'newPlayListContent', package: PACKAGE),
    publish_channel: Route::factory(name: 'publishChannel', package: PACKAGE),
    remove_channel: Route::factory(name: 'removeChannel', package: PACKAGE),
    replace_thumbnail: Route::factory(name: 'replaceThumbnailInPublishedContent', package: PACKAGE),
    unpublish_content: Route::factory(name: 'unpublishContent', package: PACKAGE),
    update_pagelet_content: Route::factory(name: 'updatePageletContent', package: PACKAGE),
    update_publishing_properties: Route::factory(name: 'updatePublishingProperties', package: PACKAGE)
  }
end

Instance Method Details

#change_channel_status(options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/thron/gateway/publishing_process.rb', line 27

def change_channel_status(options = {})
  media_content_id = options[:media_content_id]
  content_id = options[:content_id]
  channel = options[:channel]
  active = options.fetch(:active) { false }
  body = { 
    clientId: client_id,
    mediaContentId: media_content_id,
    xcontentId: content_id,
    channel: channel,
    active: active
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.extra(attribute: 'actionsInError')
    response.body = Entity::Base::factory(response.body.fetch('content') { {} })
  end
end

#get_content_types(options = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/thron/gateway/publishing_process.rb', line 45

def get_content_types(options = {})
  file_names = options[:file_names]
  body = { 
    clientId: client_id,
    files: { fileNames: file_names }
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.body = Entity::Base::factory(response.body.fetch('fileContentTypes') { [] })
  end
end

#unpublish_content(options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/thron/gateway/publishing_process.rb', line 56

def unpublish_content(options = {})
  media_content_id = options[:media_content_id]
  content_id = options[:content_id]
  force = options.fetch(:force) { false }
  remove_source_files = options.fetch(:remove_source_files) { false }
  body = { 
    clientId: client_id,
    mediaContentId: media_content_id,
    xcontentId: content_id,
    force: force,
    removeSourceFiles: remove_source_files
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.extra(attribute: 'actionsInError')
    response.body = Entity::Base::factory(response.body.fetch('content') { {} })
  end
end

#update_pagelet_content(options = {}) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/thron/gateway/publishing_process.rb', line 74

def update_pagelet_content(options = {})
  media_content_id = options[:media_content_id]
  content_id = options[:content_id]
  body = options[:body]
  mime_type = options[:mime_type]
  body = { 
    clientId: client_id,
    mediaContentId: media_content_id,
    xcontentId: content_id,
    body: body,
    mimeType: mime_type
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.extra(attribute: 'actionsInError')
    response.body = Entity::Base::factory(response.body.fetch('content') { {} })
  end
end

#update_publishing_properties(options = {}) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/thron/gateway/publishing_process.rb', line 92

def update_publishing_properties(options = {})
  media_content_id = options[:media_content_id]
  content_id = options[:content_id]
  properties = options[:properties]
  body = { 
    clientId: client_id,
    mediaContentId: media_content_id,
    xcontentId: content_id,
    properties: properties
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.extra(attribute: 'actionsInError')
    response.body = Entity::Base::factory(response.body.fetch('content') { {} })
  end
end