Class: KaveRestApi::Receive

Inherits:
RequestBase show all
Includes:
Validatable
Defined in:
lib/kave_rest_api/requests/receive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Receive

Returns a new instance of Receive.



10
11
12
13
14
15
16
# File 'lib/kave_rest_api/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

#isreadObject

Returns the value of attribute isread.



3
4
5
# File 'lib/kave_rest_api/requests/receive.rb', line 3

def isread
  @isread
end

#linenumberObject

Returns the value of attribute linenumber.



3
4
5
# File 'lib/kave_rest_api/requests/receive.rb', line 3

def linenumber
  @linenumber
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/kave_rest_api/requests/receive.rb', line 4

def response
  @response
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
# File 'lib/kave_rest_api/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