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