Class: KaveRestApi::CountInBox
- Inherits:
-
RequestBase
- Object
- RequestBase
- KaveRestApi::CountInBox
- Includes:
- Validatable
- Defined in:
- lib/kavenegar-ruby/requests/countinbox.rb
Instance Attribute Summary collapse
-
#enddate ⇒ Object
Returns the value of attribute enddate.
-
#linenumber ⇒ Object
Returns the value of attribute linenumber.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#startdate ⇒ Object
Returns the value of attribute startdate.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ CountInBox
constructor
A new instance of CountInBox.
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
#enddate ⇒ Object
Returns the value of attribute enddate.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/countinbox.rb', line 5 def enddate @enddate end |
#linenumber ⇒ Object
Returns the value of attribute linenumber.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/countinbox.rb', line 5 def linenumber @linenumber end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/kavenegar-ruby/requests/countinbox.rb', line 6 def response @response end |
#startdate ⇒ Object
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
#call ⇒ Object
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 |