Class: Appwrite::Locale

Inherits:
Service show all
Defined in:
lib/appwrite/services/locale.rb

Instance Method Summary collapse

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

#getLocale

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))

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/appwrite/services/locale.rb', line 19

def get()
    api_path = '/locale'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::Locale
    )
end

#list_codesLocaleCodeList

List of all locale codes in [ISO 639-1](en.wikipedia.org/wiki/List_of_ISO_639-1_codes).

Returns:

  • (LocaleCodeList)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/appwrite/services/locale.rb', line 43

def list_codes()
    api_path = '/locale/codes'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::LocaleCodeList
    )
end

#list_continentsContinentList

List of all continents. You can use the locale header to get the data in a supported language.

Returns:

  • (ContinentList)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/appwrite/services/locale.rb', line 67

def list_continents()
    api_path = '/locale/continents'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::ContinentList
    )
end

#list_countriesCountryList

List of all countries. You can use the locale header to get the data in a supported language.

Returns:

  • (CountryList)


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/appwrite/services/locale.rb', line 91

def list_countries()
    api_path = '/locale/countries'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::CountryList
    )
end

#list_countries_euCountryList

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.

Returns:

  • (CountryList)


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/appwrite/services/locale.rb', line 115

def list_countries_eu()
    api_path = '/locale/countries/eu'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::CountryList
    )
end

#list_countries_phonesPhoneList

List of all countries phone codes. You can use the locale header to get the data in a supported language.

Returns:

  • (PhoneList)


139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/appwrite/services/locale.rb', line 139

def list_countries_phones()
    api_path = '/locale/countries/phones'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::PhoneList
    )
end

#list_currenciesCurrencyList

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.

Returns:

  • (CurrencyList)


164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/appwrite/services/locale.rb', line 164

def list_currencies()
    api_path = '/locale/currencies'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::CurrencyList
    )
end

#list_languagesLanguageList

List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.

Returns:

  • (LanguageList)


188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/appwrite/services/locale.rb', line 188

def list_languages()
    api_path = '/locale/languages'

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::LanguageList
    )
end