Class: TextBelt::TextUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/textbelt/textutils.rb

Class Method Summary collapse

Class Method Details

.url_for(country) ⇒ URI

Return the correct URL for the correct country code



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/textbelt/textutils.rb', line 11

def url_for(country)
  url_string =
    case country
    when 'US'
      base_url + 'text'
    when 'CA'
      base_url + 'canada'
    else
      base_url + 'intl'
    end

  URI(url_string)
end