Class: Thron::Gateway::Metadata

Inherits:
Session show all
Defined in:
lib/thron/gateway/metadata.rb

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

Constructor Details

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

Class Method Details

.routesObject



9
10
11
12
13
14
15
16
17
# File 'lib/thron/gateway/metadata.rb', line 9

def self.routes
  @routes ||= {
    insert_metadata: Route::factory(name: 'insertMetadata', package: PACKAGE),
    remove_all_metadata: Route::factory(name: 'removeAllMetadata', package: PACKAGE),
    remove_metadata: Route::factory(name: 'removeMetadata', package: PACKAGE),
    update_metadata: Route::factory(name: 'updateMetadata', package: PACKAGE),
    update_single_metadata: Route::factory(name: 'updateSingleMetadata', package: PACKAGE)
  }
end

Instance Method Details

#insert_metadata(options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/thron/gateway/metadata.rb', line 19

def (options = {})
  content_id = options[:content_id]
  data = options[:data]
  category_id = options[:category_id]
  body = { 
    client: { clientId: client_id },
    contentId: content_id,
    metadata: data,
    categoryIdForAcl: category_id
  }
  route(to: __callee__, body: body, token_id: token_id)
end

#remove_all_metadata(options = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/thron/gateway/metadata.rb', line 32

def (options = {})
  content_id = options[:content_id]
  body = { 
    clientId: client_id,
    contentId: content_id
  }
  route(to: __callee__, body: body, token_id: token_id)
end

#update_metadata(options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/thron/gateway/metadata.rb', line 41

def (options = {})
  content_id = options[:content_id]
  data_list = options[:data_list]
  category_id = options[:category_id]
  body = { 
    clientId: client_id,
    contentId: content_id,
    metadata: { metadata: data_list },
    categoryIdForAcl: category_id
  }
  route(to: __callee__, body: body, token_id: token_id)
end