Sha256: c2bb72365b6f802cf1364af074ddff35bfe18bde82c0aefaec723638442d054f

Contents?: true

Size: 1.02 KB

Versions: 36

Compression:

Stored size: 1.02 KB

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 page(page)
          set :page, page
        end

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

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
portatext-1.5.5 lib/portatext/command/api/blacklist.rb
portatext-1.5.4 lib/portatext/command/api/blacklist.rb
portatext-1.5.3 lib/portatext/command/api/blacklist.rb
portatext-1.5.2 lib/portatext/command/api/blacklist.rb
portatext-1.5.1 lib/portatext/command/api/blacklist.rb
portatext-1.5.0 lib/portatext/command/api/blacklist.rb
portatext-1.4.4 lib/portatext/command/api/blacklist.rb
portatext-1.4.3 lib/portatext/command/api/blacklist.rb
portatext-1.4.2 lib/portatext/command/api/blacklist.rb
portatext-1.4.1 lib/portatext/command/api/blacklist.rb
portatext-1.4.0 lib/portatext/command/api/blacklist.rb
portatext-1.3.1 lib/portatext/command/api/blacklist.rb
portatext-1.3.0 lib/portatext/command/api/blacklist.rb
portatext-1.2.0 lib/portatext/command/api/blacklist.rb
portatext-1.1.11 lib/portatext/command/api/blacklist.rb
portatext-1.1.10 lib/portatext/command/api/blacklist.rb