Sha256: bcd83d2521d82bb1faedca232db262221f054bc759efdb8364ec7cc826825195

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

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

        def name(name)
          set :name, name
        end

        def description(description)
          set :description, description
        end

        def csv(file)
          set :file, file
        end

        def save_to(file)
          set :accept_file, file
        end

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

Version data entries

7 entries across 7 versions & 1 rubygems

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