Sha256: 963ac9db3e87b2fe25029b963c2a38100fdfd7f9f51ca42dfa6c82d42f75094d

Contents?: true

Size: 893 Bytes

Versions: 8

Compression:

Stored size: 893 Bytes

Contents

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

        def csv(file)
          set :file, file
        end

        def save_to(file)
          set :accept_file, file
        end

        def endpoint(_method)
          return 'blacklist/contacts' unless @args[:accept_file].nil?
          return 'blacklist/contacts' unless @args[:file].nil?
          return 'blacklist' if @args[:number].nil?
          number = @args[:number]
          @args.delete :number
          "blacklist/#{number}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
portatext-1.1.9 lib/portatext/command/api/blacklist.rb
portatext-1.1.8 lib/portatext/command/api/blacklist.rb
portatext-1.1.7 lib/portatext/command/api/blacklist.rb
portatext-1.1.6 lib/portatext/command/api/blacklist.rb
portatext-1.1.5 lib/portatext/command/api/blacklist.rb
portatext-1.1.4 lib/portatext/command/api/blacklist.rb
portatext-1.1.3 lib/portatext/command/api/blacklist.rb
portatext-1.1.2 lib/portatext/command/api/blacklist.rb