Class: PortaText::Command::Api::NumberVerify

Inherits:
Base
  • Object
show all
Defined in:
lib/portatext/command/api/number_verify.rb

Overview

The number verify endpoint. github.com/PortaText/docs/wiki/REST-API#api_number_verify

Author

Marcelo Gornstein ([email protected])

Copyright

Copyright © 2015 PortaText

License

Apache-2.0

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#accept_content_type, #body, #content_type, #delete, #get, #initialize, #patch, #post, #put, #set

Constructor Details

This class inherits a constructor from PortaText::Command::Base

Instance Method Details

#endpoint(_method) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/portatext/command/api/number_verify.rb', line 28

def endpoint(_method)
  raise 'DID number cant be null' if @args[:number].nil?
  number = @args[:number]
  @args.delete :number
  return "number_verify/#{number}" if @args[:code].nil?
  code = @args[:code]
  @args.delete :code
  "number_verify/#{number}?code=#{code}"
end

#for_number(number) ⇒ Object



11
12
13
# File 'lib/portatext/command/api/number_verify.rb', line 11

def for_number(number)
  set :number, number
end

#from(from) ⇒ Object



15
16
17
# File 'lib/portatext/command/api/number_verify.rb', line 15

def from(from)
  set :from, from
end

#use_template(id, variables = {}) ⇒ Object



23
24
25
26
# File 'lib/portatext/command/api/number_verify.rb', line 23

def use_template(id, variables = {})
  set :template_id, id
  set :variables, variables
end

#verify_with(code) ⇒ Object



19
20
21
# File 'lib/portatext/command/api/number_verify.rb', line 19

def verify_with(code)
  set :code, code
end