Class: KaveRestApi::Deliver
- Inherits:
-
RequestBase
- Object
- RequestBase
- KaveRestApi::Deliver
- Includes:
- Validatable
- Defined in:
- lib/kavenegar-ruby/requests/deliver.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 = {}) ⇒ Deliver
constructor
A new instance of Deliver.
Constructor Details
#initialize(args = {}) ⇒ Deliver
Returns a new instance of Deliver.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kavenegar-ruby/requests/deliver.rb', line 10 def initialize(args = {}) @ACTION_NAME = [:status,@FORMAT].join('.').freeze @messageid = args.fetch(:messageid) if @messageid.kind_of?(Array) raise(ArgumentError,'Message Id Arrays: Buffer Overflow: Max length 3000 of array') if @messageid.length > 3000 @messageid = @messageid.join(',') end @messageid = @messageid.ctsd @response = ResponseDeliver.new end |
Instance Attribute Details
#messageid ⇒ Object
Returns the value of attribute messageid.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/deliver.rb', line 5 def @messageid end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/kavenegar-ruby/requests/deliver.rb', line 6 def response @response end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/kavenegar-ruby/requests/deliver.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, messageid: @messageid) @response.validate(response.body) end |