Class: TextBelt::TextUtils

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

Class Method Summary collapse

Class Method Details

.uri_for(country) ⇒ URI

Return the correct URI for the correct country code

Parameters:

  • country (String)

    ISO 3166 Country code for destination country

Returns:

  • (URI)

    URI object holding the uri to match the country code



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

def uri_for(country)
  uri_string =
    case country
    when 'US'
      base_uri + 'text'
    when 'CA'
      base_uri + 'canada'
    else
      base_uri + 'intl'
    end

  URI(uri_string)
end