Sha256: 588b06f4fd08b25545881969e72ff86fb0621b08a2c3167c600b403117dd052d

Contents?: true

Size: 896 Bytes

Versions: 4

Compression:

Stored size: 896 Bytes

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 endpoint(_method)
          return 'contact_lists' if @args[:id].nil?
          id = @args[:id]
          @args.delete :id
          return "contact_lists/#{id}/contacts" unless @args[:file].nil?
          "contact_lists/#{id}"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
portatext-1.1.1 lib/portatext/command/api/contact_lists.rb
portatext-1.1.0 lib/portatext/command/api/contact_lists.rb
portatext-1.0.0 lib/portatext/command/api/contact_lists.rb
portatext-1.0.0.pre lib/portatext/command/api/contact_lists.rb