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