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(total: nil) ⇒ LocaleCodeList
List of all locale codes in ISO 639-1.
-
#list_continents(total: nil) ⇒ ContinentList
List of all continents.
-
#list_countries(total: nil) ⇒ CountryList
List of all countries.
-
#list_countries_eu(total: nil) ⇒ CountryList
List of all countries that are currently members of the EU.
-
#list_countries_phones(total: nil) ⇒ PhoneList
List of all countries phone codes.
-
#list_currencies(total: nil) ⇒ CurrencyList
List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies.
-
#list_languages(total: nil) ⇒ 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.
5 6 7 |
# File 'lib/appwrite/services/locale.rb', line 5 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/appwrite/services/locale.rb', line 18 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(total: nil) ⇒ LocaleCodeList
List of all locale codes in ISO 639-1.
43 44 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 43 def list_codes( total: nil ) api_path = '/locale/codes' api_params = { total: total, } 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(total: nil) ⇒ ContinentList
List of all continents. You can use the locale header to get the data in a supported language.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/appwrite/services/locale.rb', line 72 def list_continents( total: nil ) api_path = '/locale/continents' api_params = { total: total, } 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(total: nil) ⇒ CountryList
List of all countries. You can use the locale header to get the data in a supported language.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/appwrite/services/locale.rb', line 101 def list_countries( total: nil ) api_path = '/locale/countries' api_params = { total: total, } 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(total: nil) ⇒ 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.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/appwrite/services/locale.rb', line 130 def list_countries_eu( total: nil ) api_path = '/locale/countries/eu' api_params = { total: total, } 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(total: nil) ⇒ PhoneList
List of all countries phone codes. You can use the locale header to get the data in a supported language.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/appwrite/services/locale.rb', line 159 def list_countries_phones( total: nil ) api_path = '/locale/countries/phones' api_params = { total: total, } 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(total: nil) ⇒ 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.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/appwrite/services/locale.rb', line 189 def list_currencies( total: nil ) api_path = '/locale/currencies' api_params = { total: total, } 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(total: nil) ⇒ LanguageList
List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/appwrite/services/locale.rb', line 218 def list_languages( total: nil ) api_path = '/locale/languages' api_params = { total: total, } 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 |