Class: KaveRestApi::CountInBox

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ CountInBox

Returns a new instance of CountInBox.



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

def initialize(args = {})
  super
  @ACTION_NAME    = [:countinbox,@FORMAT].join('.').freeze
  @startdate      = args.fetch(:startdate)
  @enddate        = args.fetch(:enddate,nil)
  @linenumber     = args.fetch(:linenumber,nil)
  @isread         = args.fetch(:isread,nil)
  @response       = ResponseCountInBox.new
end

Instance Attribute Details

#enddateObject

Returns the value of attribute enddate.



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

def enddate
  @enddate
end

#linenumberObject

Returns the value of attribute linenumber.



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

def linenumber
  @linenumber
end

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

#startdateObject

Returns the value of attribute startdate.



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

def startdate
  @startdate
end

Instance Method Details

#callObject



23
24
25
26
27
28
29
30
# File 'lib/kavenegar-ruby/requests/countinbox.rb', line 23

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,isread: @isread, linenumber: @linenumber,startdate: @startdate,enddate: @enddate)
     @response.validate(response.body)
end