Class: PortaText::Command::Api::Blacklist

Inherits:
Base
  • Object
show all
Defined in:
lib/portatext/command/api/blacklist.rb

Overview

The blacklist endpoint. github.com/PortaText/docs/wiki/REST-API#api_blacklist

Author

Marcelo Gornstein ([email protected])

Copyright

Copyright © 2015 PortaText

License

Apache-2.0

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#accept_content_type, #body, #content_type, #delete, #get, #initialize, #patch, #post, #put, #set

Constructor Details

This class inherits a constructor from PortaText::Command::Base

Instance Method Details

#csv(file) ⇒ Object



15
16
17
# File 'lib/portatext/command/api/blacklist.rb', line 15

def csv(file)
  set :file, file
end

#endpoint(_method) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/portatext/command/api/blacklist.rb', line 27

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

#number(number) ⇒ Object



11
12
13
# File 'lib/portatext/command/api/blacklist.rb', line 11

def number(number)
  set :number, number
end

#page(page) ⇒ Object



23
24
25
# File 'lib/portatext/command/api/blacklist.rb', line 23

def page(page)
  set :page, page
end

#save_to(file) ⇒ Object



19
20
21
# File 'lib/portatext/command/api/blacklist.rb', line 19

def save_to(file)
  set :accept_file, file
end