Class: JxClient::PutDocument

Inherits:
OperationBase show all
Defined in:
lib/jx_client/put_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



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

def self.from_jx_client(jx_client)
  new(
    operation_name: :put_document,
    client: jx_client.client,
    default_options: jx_client.jx_default_options,
    operation_default_options: jx_client.jx_default_put_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



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

def locals(options)
  {
    soap_header: {
      From: options[:from],
      To: options[:to],
      MessageId: options[:message_id],
      Timestamp: options[:timestamp],
    },
    message: {
      messageId: options[:message_id],
      data: Base64.strict_encode64(options[:data]),
      senderId: options[:sender_id],
      receiverId: options[:receiver_id],
      formatType: options[:format_type],
      documentType: options[:document_type],
      compressType: options[:compress_type],
    },
  }
end

#wrap_response(response) ⇒ Object



18
19
20
21
22
23
# File 'lib/jx_client/put_document.rb', line 18

def wrap_response(response)
  response.define_singleton_method(:result) do
    body[:put_document_response][:put_document_result]
  end
  response
end