Class: JxClient::GetDocument

Inherits:
OperationBase show all
Defined in:
lib/jx_client/get_document.rb

Instance Attribute Summary

Attributes inherited from OperationBase

#response, #sent_options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OperationBase

#call, #initialize, #merge_options, #new_message_id, #new_timestamp, #options, #sent_locals, #with_generated

Constructor Details

This class inherits a constructor from JxClient::OperationBase

Class Method Details

.from_jx_client(jx_client) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/jx_client/get_document.rb', line 8

def self.from_jx_client(jx_client)
  new(
    operation_name: :get_document,
    client: jx_client.client,
    default_options: jx_client.jx_default_options,
    operation_default_options: jx_client.jx_default_get_document_options,
    message_id_generate: jx_client.jx_message_id_generate,
    timestamp_generate: jx_client.jx_timestamp_generate,
  )
end

Instance Method Details

#locals(options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jx_client/get_document.rb', line 26

def locals(options)
  soap_header = {
    From: options[:from],
    To: options[:to],
    MessageId: options[:message_id],
    Timestamp: options[:timestamp],
  }
  soap_header[:OptionalFormatType] = options[:optional_format_type] if options[:optional_format_type]
  soap_header[:OptionalDocumentType] = options[:optional_document_type] if options[:optional_document_type]

  {
    soap_header: soap_header,
    message: {
      receiverId: options[:receiver_id],
    },
  }
end

#wrap_response(response) ⇒ Object



19
20
21
22
23
24
# File 'lib/jx_client/get_document.rb', line 19

def wrap_response(response)
  response.define_singleton_method(:result) do
    @result ||= GetDocumentResult.new(**body[:get_document_response])
  end
  response
end