Sha256: 8031637c2955f66053d1eb8ac088e3a741a11678e6157333fa038f4185413cab

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

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

        def disable_cnam
          set :cnam_enabled, false
        end

        def enable_cnam
          set :cnam_enabled, true
        end

        def dont_autorespond
          set :autoresponder_enabled, false
        end

        def autorespond_with(text)
          set :autoresponder_text, text
          set :autoresponder_enabled, true
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
portatext-1.2.0 lib/portatext/command/api/did_settings.rb
portatext-1.1.11 lib/portatext/command/api/did_settings.rb