Class: Appwrite::Locale
- Defined in:
- lib/appwrite/services/locale.rb
Instance Method Summary collapse
-
#get ⇒ Locale
Get the current user location based on IP.
-
#initialize(client) ⇒ Locale
constructor
A new instance of Locale.
-
#list_continents ⇒ ContinentList
List of all continents.
-
#list_countries ⇒ CountryList
List of all countries.
-
#list_countries_eu ⇒ CountryList
List of all countries that are currently members of the EU.
-
#list_countries_phones ⇒ PhoneList
List of all countries phone codes.
-
#list_currencies ⇒ CurrencyList
List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies.
-
#list_languages ⇒ LanguageList
List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
Constructor Details
#initialize(client) ⇒ Locale
Returns a new instance of Locale.
6 7 8 |
# File 'lib/appwrite/services/locale.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#get ⇒ Locale
Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
([IP Geolocation by DB-IP](db-ip.com))
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/appwrite/services/locale.rb', line 19 def get() path = '/locale' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::Locale ) end |
#list_continents ⇒ ContinentList
List of all continents. You can use the locale header to get the data in a supported language.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/appwrite/services/locale.rb', line 44 def list_continents() path = '/locale/continents' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::ContinentList ) end |
#list_countries ⇒ CountryList
List of all countries. You can use the locale header to get the data in a supported language.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/appwrite/services/locale.rb', line 69 def list_countries() path = '/locale/countries' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::CountryList ) end |
#list_countries_eu ⇒ CountryList
List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/appwrite/services/locale.rb', line 94 def list_countries_eu() path = '/locale/countries/eu' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::CountryList ) end |
#list_countries_phones ⇒ PhoneList
List of all countries phone codes. You can use the locale header to get the data in a supported language.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/appwrite/services/locale.rb', line 119 def list_countries_phones() path = '/locale/countries/phones' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::PhoneList ) end |
#list_currencies ⇒ CurrencyList
List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/appwrite/services/locale.rb', line 145 def list_currencies() path = '/locale/currencies' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::CurrencyList ) end |
#list_languages ⇒ LanguageList
List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/appwrite/services/locale.rb', line 170 def list_languages() path = '/locale/languages' params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::LanguageList ) end |