Class: PortaText::Command::Api::Services

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

Overview

The sms_services endpoint. github.com/PortaText/docs/wiki/REST-API#api_sms_services

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

#endpoint(_method) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/portatext/command/api/services.rb', line 23

def endpoint(_method)
  base = 'sms_services'
  return base if @args[:id].nil?
  id = @args[:id]
  @args.delete :id
  page = @args[:page]
  @args.delete :page
  return "#{base}/#{id}/subscribers" unless @args[:accept_file].nil?
  return "#{base}/#{id}/subscribers?page=#{page}" unless page.nil?
  "#{base}/#{id}"
end

#id(id) ⇒ Object



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

def id(id)
  set :id, id
end

#page(page) ⇒ Object



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

def page(page)
  set :page, page
end

#save_to(file) ⇒ Object



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

def save_to(file)
  set :accept_file, file
end