Module: Grpc::Client::ORiN3::Provider::ORiN3ResourceOpener

Included in:
ORiN3Controller, ORiN3File, ORiN3Job, ORiN3Stream
Defined in:
lib/grpc/client/orin3/provider/orin3_resource_opener.rb

Instance Method Summary collapse

Instance Method Details

#close(argument = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/grpc/client/orin3/provider/orin3_resource_opener.rb', line 31

def close(argument = nil)
  argument = argument.nil? ? {} : argument
  begin
    resource_opener = O3::ResourceOpenerService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::CloseRequest.new(common: O3P::CommonRequest.new, id: @internal_id, argument: ORiN3BinaryConverter.from_dictionary_to_binary(argument))
    response = resource_opener.close(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
  rescue MessageClientError
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end            
end

#open(argument = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/grpc/client/orin3/provider/orin3_resource_opener.rb', line 15

def open(argument = nil)
  argument = argument.nil? ? {} : argument
  begin
    resource_opener = O3::ResourceOpenerService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::OpenRequest.new(common: O3P::CommonRequest.new, id: @internal_id, argument: ORiN3BinaryConverter.from_dictionary_to_binary(argument))
    response = resource_opener.open(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
  rescue MessageClientError => ee
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end            
end