Class: Laximo::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/laximo/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(soap_endpoint, soap_action) ⇒ Request

Returns a new instance of Request.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/laximo/request.rb', line 19

def initialize(soap_endpoint, soap_action)

  @soap_endpoint  = soap_endpoint
  @soap_action    = soap_action

  @uri     = URI(soap_endpoint)
  @http    = ::Net::HTTP.new(@uri.host, @uri.port)
  @request = ::Net::HTTP::Post.new(@uri.request_uri)

  set_request_params
  set_http_params

end

Instance Method Details

#call(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/laximo/request.rb', line 33

def call(*args)

  msg = args.join("\n")

  @request.body = (REQUEST_LOGIN_MSG % {
    msg:   msg,
    act:   @soap_action,
    login: ::Laximo.options.,
    hash:  hash(msg, ::Laximo.options.password)
  })

  begin
    @http.request @request
  rescue ::Exception => ex
    ex
  end

end