Class: KaveRestApi::LatestOutBox
- Inherits:
-
RequestBase
- Object
- RequestBase
- KaveRestApi::LatestOutBox
- Includes:
- Validatable
- Defined in:
- lib/kavenegar-ruby/requests/latestoutbox.rb
Instance Attribute Summary collapse
-
#pagesize ⇒ Object
Returns the value of attribute pagesize.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ LatestOutBox
constructor
A new instance of LatestOutBox.
Constructor Details
#initialize(args = {}) ⇒ LatestOutBox
Returns a new instance of LatestOutBox.
9 10 11 12 13 14 15 |
# File 'lib/kavenegar-ruby/requests/latestoutbox.rb', line 9 def initialize(args = {}) super @ACTION_NAME = [:latestoutbox,@FORMAT].join('.').freeze @pagesize = args.fetch(:pagesize,3000).ctsd @sender = args.fetch(:sender,nil) @response = ResponseLatestOutBox.new end |
Instance Attribute Details
#pagesize ⇒ Object
Returns the value of attribute pagesize.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/latestoutbox.rb', line 4 def pagesize @pagesize end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/latestoutbox.rb', line 5 def response @response end |
#sender ⇒ Object
Returns the value of attribute sender.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/latestoutbox.rb', line 4 def sender @sender end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/kavenegar-ruby/requests/latestoutbox.rb', line 17 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,pagesize: @pagesize) @response.validate(response.body) end |