Class: IsbmAdaptor::ChannelManagement
- Defined in:
- lib/isbm_adaptor/channel_management.rb
Instance Method Summary collapse
-
#add_security_tokens(uri, tokens = {}) ⇒ void
Adds security tokens to a channel.
-
#create_channel(uri, type, description = nil, tokens = {}) ⇒ void
Creates a new channel.
-
#delete_channel(uri) ⇒ void
Deletes the specified channel.
-
#get_channel(uri) { ... } ⇒ Channel
Gets information about the specified channel.
-
#get_channels { ... } ⇒ Array<Channel>
Gets information about all channels.
-
#initialize(endpoint, options = {}) ⇒ ChannelManagement
constructor
Creates a new ISBM ChannelManagement client.
-
#remove_security_tokens(uri, tokens = {}) ⇒ void
Removes security tokens from a channel.
Methods inherited from Client
#extract_message, #validate_inclusion_in, #validate_presence_of, #validate_xml
Constructor Details
#initialize(endpoint, options = {}) ⇒ ChannelManagement
Creates a new ISBM ChannelManagement client.
13 14 15 |
# File 'lib/isbm_adaptor/channel_management.rb', line 13 def initialize(endpoint, = {}) super('ChannelManagementService.wsdl', endpoint, ) end |
Instance Method Details
#add_security_tokens(uri, tokens = {}) ⇒ void
This method returns an undefined value.
Adds security tokens to a channel.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/isbm_adaptor/channel_management.rb', line 47 def add_security_tokens(uri, tokens = {}) validate_presence_of uri, 'Channel URI' validate_presence_of tokens, 'Security Tokens' = { 'ChannelURI' => uri, 'SecurityToken' => security_token_hash(tokens) } @client.call(:add_security_tokens, message: ) return true end |
#create_channel(uri, type, description = nil, tokens = {}) ⇒ void
This method returns an undefined value.
Creates a new channel.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/isbm_adaptor/channel_management.rb', line 25 def create_channel(uri, type, description = nil, tokens = {}) validate_presence_of uri, 'Channel URI' validate_presence_of type, 'Channel Type' channel_type = type.to_s.downcase.capitalize validate_inclusion_in channel_type, IsbmAdaptor::Channel::TYPES, 'Channel Type' = { 'ChannelURI' => uri, 'ChannelType' => channel_type } ['ChannelDescription'] = description unless description.nil? ['SecurityToken'] = security_token_hash(tokens) if tokens.any? @client.call(:create_channel, message: ) return true end |
#delete_channel(uri) ⇒ void
This method returns an undefined value.
Deletes the specified channel.
82 83 84 85 86 87 88 |
# File 'lib/isbm_adaptor/channel_management.rb', line 82 def delete_channel(uri) validate_presence_of uri, 'Channel URI' @client.call(:delete_channel, message: { 'ChannelURI' => uri }) return true end |
#get_channel(uri) { ... } ⇒ Channel
Gets information about the specified channel.
96 97 98 99 100 101 102 103 |
# File 'lib/isbm_adaptor/channel_management.rb', line 96 def get_channel(uri, &block) validate_presence_of uri, 'Channel URI' response = @client.call(:get_channel, message: { 'ChannelURI' => uri }, &block) hash = response.to_hash[:get_channel_response][:channel] IsbmAdaptor::Channel.from_hash(hash) end |
#get_channels { ... } ⇒ Array<Channel>
Gets information about all channels.
109 110 111 112 113 114 115 116 117 |
# File 'lib/isbm_adaptor/channel_management.rb', line 109 def get_channels(&block) response = @client.call(:get_channels, {}, &block) channels = response.to_hash[:get_channels_response][:channel] channels = [channels].compact unless channels.is_a?(Array) channels.map do |hash| IsbmAdaptor::Channel.from_hash(hash) end end |
#remove_security_tokens(uri, tokens = {}) ⇒ void
This method returns an undefined value.
Removes security tokens from a channel.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/isbm_adaptor/channel_management.rb', line 65 def remove_security_tokens(uri, tokens = {}) validate_presence_of uri, 'Channel URI' validate_presence_of tokens, 'Security Tokens' = { 'ChannelURI' => uri, 'SecurityToken' => security_token_hash(tokens) } @client.call(:remove_security_tokens, message: ) return true end |