Class: KaveRestApi::Cancel
- Inherits:
-
RequestBase
- Object
- RequestBase
- KaveRestApi::Cancel
- Includes:
- Validatable
- Defined in:
- lib/kavenegar-ruby/requests/cancel.rb
Instance Attribute Summary collapse
-
#messageid ⇒ Object
Returns the value of attribute messageid.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ Cancel
constructor
A new instance of Cancel.
- #valid? ⇒ Boolean
Constructor Details
#initialize(args = {}) ⇒ Cancel
Returns a new instance of Cancel.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kavenegar-ruby/requests/cancel.rb', line 12 def initialize(args = {}) super @ACTION_NAME = [:countinbox,@FORMAT].join('.').freeze @messageid = args.fetch(:messageid) if @messageid.kind_of?(Array) @valid= false if @messageid.length > 200 @messageid = @messageid.join(',') end @messageid = @messageid.ctsd @response = ResponseCancel.new end |
Instance Attribute Details
#messageid ⇒ Object
Returns the value of attribute messageid.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/cancel.rb', line 5 def @messageid end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/kavenegar-ruby/requests/cancel.rb', line 6 def response @response end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/kavenegar-ruby/requests/cancel.rb', line 29 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 |
#valid? ⇒ Boolean
25 26 27 |
# File 'lib/kavenegar-ruby/requests/cancel.rb', line 25 def valid? @valid ||= true end |