Class: PortaText::Command::Api::Sms

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

Overview

The sms endpoint. github.com/PortaText/docs/wiki/REST-API#api_sms

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

#client_ref(client_ref) ⇒ Object



36
37
38
# File 'lib/portatext/command/api/sms.rb', line 36

def client_ref(client_ref)
  set :client_ref, client_ref
end

#endpoint(_method) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/portatext/command/api/sms.rb', line 54

def endpoint(_method)
  unless @args[:search_params].nil?
    qs = URI.encode_www_form @args[:search_params]
    @args.delete :search_params
    return "sms?#{qs}"
  end

  return 'sms' if @args[:id].nil?
  id = @args[:id]
  @args.delete :id
  "sms/#{id}"
end

#from(from) ⇒ Object



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

def from(from)
  set :from, from
end

#from_service(service_id) ⇒ Object



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

def from_service(service_id)
  set :service_id, service_id
end

#id(id) ⇒ Object



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

def id(id)
  set :id, id
end

#schedule(type, details) ⇒ Object



48
49
50
51
52
# File 'lib/portatext/command/api/sms.rb', line 48

def schedule(type, details)
  schedule = {}
  schedule[type] = details
  set :schedule, schedule
end

#search(params) ⇒ Object



44
45
46
# File 'lib/portatext/command/api/sms.rb', line 44

def search(params)
  set :search_params, params
end

#text(text) ⇒ Object



32
33
34
# File 'lib/portatext/command/api/sms.rb', line 32

def text(text)
  set :text, text
end

#to(to) ⇒ Object



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

def to(to)
  set :to, to
end

#to_contact_lists(contact_lists) ⇒ Object



40
41
42
# File 'lib/portatext/command/api/sms.rb', line 40

def to_contact_lists(contact_lists)
  set :contact_list_ids, contact_lists
end

#use_template(id, variables = {}) ⇒ Object



27
28
29
30
# File 'lib/portatext/command/api/sms.rb', line 27

def use_template(id, variables = {})
  set :template_id, id
  set :variables, variables
end