Class: Kave::LatestOutBox

Inherits:
Object
  • Object
show all
Defined in:
lib/kave/send_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ LatestOutBox

Returns a new instance of LatestOutBox.



46
47
48
49
50
51
52
# File 'lib/kave/send_request.rb', line 46

def initialize(args = {})
  @pagesize    = args.fetch(:pagesize) 
  @wsdl        = Savon.client(wsdl: Kave.configuration.wsdl, pretty_print_xml: true)
  @response    = ResponseLatestOutBox.new
  @username    = Kave.configuration.username || ''
  @password    = Kave.configuration.password || ''
end

Instance Attribute Details

#pagesizeObject

Returns the value of attribute pagesize.



43
44
45
# File 'lib/kave/send_request.rb', line 43

def pagesize
  @pagesize
end

#responseObject (readonly)

Returns the value of attribute response.



44
45
46
# File 'lib/kave/send_request.rb', line 44

def response
  @response
end

Instance Method Details

#callObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/kave/send_request.rb', line 54

def call
  @selectlatest_by=unless Kave.configuration.api_key.nil?
:selectlatest_by_apikey
else
:selectlatest_by_login_info
end
@pagesize=if @pagesize < 2;2;else;@pagesize;end
  response = @wsdl.call :selectlatest_by_apikey, message: {
    'apikey' =>Kave.configuration.api_key,
    'pagesize'=>@pagesize.to_i,
    'sender' => Kave.configuration.sender
  }
  @response.validate(response.body,@send_latest_by)
end