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_codes ⇒ LocaleCodeList
List of all locale codes in ISO 639-1.
-
#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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/appwrite/services/locale.rb', line 19 def get() api_path = '/locale' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Locale ) end |
#list_codes ⇒ LocaleCodeList
List of all locale codes in ISO 639-1.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/appwrite/services/locale.rb', line 45 def list_codes() api_path = '/locale/codes' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::LocaleCodeList ) end |
#list_continents ⇒ ContinentList
List of all continents. You can use the locale header to get the data in a supported language.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/appwrite/services/locale.rb', line 71 def list_continents() api_path = '/locale/continents' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_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.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/appwrite/services/locale.rb', line 97 def list_countries() api_path = '/locale/countries' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_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.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/appwrite/services/locale.rb', line 123 def list_countries_eu() api_path = '/locale/countries/eu' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_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.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/appwrite/services/locale.rb', line 149 def list_countries_phones() api_path = '/locale/countries/phones' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_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.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/appwrite/services/locale.rb', line 176 def list_currencies() api_path = '/locale/currencies' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_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.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/appwrite/services/locale.rb', line 202 def list_languages() api_path = '/locale/languages' api_params = { } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::LanguageList ) end |