Class: KaveRestApi::SelectOutBox

Inherits:
RequestBase show all
Includes:
Validatable
Defined in:
lib/kavenegar-ruby/requests/selectoutbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ SelectOutBox

Returns a new instance of SelectOutBox.



12
13
14
15
16
17
18
19
# File 'lib/kavenegar-ruby/requests/selectoutbox.rb', line 12

def initialize(args = {})
  super
  @ACTION_NAME    = [:selectoutbox,@FORMAT].join('.').freeze
  @startdate   = args.fetch(:startdate)
  @enddate     = args.fetch(:enddate,nil)
  @sender      = args.fetch(:sender,nil)
  @response    = ResponseSelectOutBox.new
end

Instance Attribute Details

#enddateObject

Returns the value of attribute enddate.



5
6
7
# File 'lib/kavenegar-ruby/requests/selectoutbox.rb', line 5

def enddate
  @enddate
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/kavenegar-ruby/requests/selectoutbox.rb', line 6

def response
  @response
end

#senderObject

Returns the value of attribute sender.



5
6
7
# File 'lib/kavenegar-ruby/requests/selectoutbox.rb', line 5

def sender
  @sender
end

#startdateObject

Returns the value of attribute startdate.



5
6
7
# File 'lib/kavenegar-ruby/requests/selectoutbox.rb', line 5

def startdate
  @startdate
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
# File 'lib/kavenegar-ruby/requests/selectoutbox.rb', line 21

def call
    connection = Faraday.new(url: "#{API_URL}/sms/") do |faraday|
      faraday.adapter Faraday.default_adapter
      faraday.response FORMAT.to_sym
    end
     response = connection.get(ACTION_NAME, sender: @sender,startdate: @startdate,enddate: @enddate)
     @response.validate(response.body)
end