Class: PortaText::Command::Api::DidSearch

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

Overview

The dids/search endpoint. github.com/PortaText/docs/wiki/REST-API#api_dids_search

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, #content_type, #delete, #get, #initialize, #patch, #post, #put, #set

Constructor Details

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

Instance Method Details

#body(_method) ⇒ Object



47
48
49
# File 'lib/portatext/command/api/did_search.rb', line 47

def body(_method)
  ''
end

#contains(pattern) ⇒ Object



43
44
45
# File 'lib/portatext/command/api/did_search.rb', line 43

def contains(pattern)
  with_pattern 'anywhere', pattern
end

#endpoint(_method) ⇒ Object



51
52
53
54
# File 'lib/portatext/command/api/did_search.rb', line 51

def endpoint(_method)
  qs = URI.encode_www_form @args
  "dids/search?#{qs}"
end

#ends_with(pattern) ⇒ Object



39
40
41
# File 'lib/portatext/command/api/did_search.rb', line 39

def ends_with(pattern)
  with_pattern 'ends_with', pattern
end

#for_country(iso_code) ⇒ Object



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

def for_country(iso_code)
  set :country, iso_code
end

#localObject



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

def local
  type 'local'
end

#mobileObject



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

def mobile
  type 'mobile'
end

#nationalObject



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

def national
  type 'national'
end

#page(page) ⇒ Object



31
32
33
# File 'lib/portatext/command/api/did_search.rb', line 31

def page(page)
  set :page, page
end

#starts_with(pattern) ⇒ Object



35
36
37
# File 'lib/portatext/command/api/did_search.rb', line 35

def starts_with(pattern)
  with_pattern 'starts_with', pattern
end

#toll_freeObject



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

def toll_free
  type 'toll_free'
end