Sha256: acf332a8b5b1ea2601d91b2673777b7ad466ceb482e3682f01b95df67beacbf2

Contents?: true

Size: 1.03 KB

Versions: 35

Compression:

Stored size: 1.03 KB

Contents

module PortaText
  module Command
    module Api
      # The number verify endpoint.
      # https://github.com/PortaText/docs/wiki/REST-API#api_number_verify
      #
      # Author::    Marcelo Gornstein (mailto:marcelog@portatext.com)
      # Copyright:: Copyright (c) 2015 PortaText
      # License::   Apache-2.0
      class NumberVerify < Base
        def for_number(number)
          set :number, number
        end

        def from(from)
          set :from, from
        end

        def verify_with(code)
          set :code, code
        end

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

        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
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
portatext-1.6.1 lib/portatext/command/api/number_verify.rb
portatext-1.6.0 lib/portatext/command/api/number_verify.rb
portatext-1.5.23 lib/portatext/command/api/number_verify.rb
portatext-1.5.22 lib/portatext/command/api/number_verify.rb
portatext-1.5.21 lib/portatext/command/api/number_verify.rb
portatext-1.5.20 lib/portatext/command/api/number_verify.rb
portatext-1.5.19 lib/portatext/command/api/number_verify.rb
portatext-1.5.18 lib/portatext/command/api/number_verify.rb
portatext-1.5.17 lib/portatext/command/api/number_verify.rb
portatext-1.5.16 lib/portatext/command/api/number_verify.rb
portatext-1.5.15 lib/portatext/command/api/number_verify.rb
portatext-1.5.14 lib/portatext/command/api/number_verify.rb
portatext-1.5.13 lib/portatext/command/api/number_verify.rb
portatext-1.5.12 lib/portatext/command/api/number_verify.rb
portatext-1.5.11 lib/portatext/command/api/number_verify.rb
portatext-1.5.10 lib/portatext/command/api/number_verify.rb
portatext-1.5.9 lib/portatext/command/api/number_verify.rb
portatext-1.5.8 lib/portatext/command/api/number_verify.rb
portatext-1.5.7 lib/portatext/command/api/number_verify.rb
portatext-1.5.6 lib/portatext/command/api/number_verify.rb