Class: ReliefWebAPI::CountriesApi
- Inherits:
-
Object
- Object
- ReliefWebAPI::CountriesApi
- Defined in:
- lib/reliefweb-api/api/countries_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_countries(opts = {}) ⇒ Country
List or search countries covered by ReliefWeb.
-
#get_countries_with_http_info(opts = {}) ⇒ Array<(Country, Fixnum, Hash)>
List or search countries covered by ReliefWeb.
-
#get_country_by_id(country_id, opts = {}) ⇒ Country
Find country by its unique ID Individual countries.
-
#get_country_by_id_with_http_info(country_id, opts = {}) ⇒ Array<(Country, Fixnum, Hash)>
Find country by its unique ID Individual countries.
-
#initialize(api_client = ApiClient.default) ⇒ CountriesApi
constructor
A new instance of CountriesApi.
-
#search_countries(opts = {}) ⇒ Country
List or search countries covered by ReliefWeb.
-
#search_countries_with_http_info(opts = {}) ⇒ Array<(Country, Fixnum, Hash)>
List or search countries covered by ReliefWeb.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ CountriesApi
Returns a new instance of CountriesApi.
19 20 21 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_countries(opts = {}) ⇒ Country
List or search countries covered by ReliefWeb.
47 48 49 50 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 47 def get_countries(opts = {}) data, _status_code, _headers = get_countries_with_http_info(opts) data end |
#get_countries_with_http_info(opts = {}) ⇒ Array<(Country, Fixnum, Hash)>
List or search countries covered by ReliefWeb.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 77 def get_countries_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CountriesApi.get_countries ...' end if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator']) fail ArgumentError, 'invalid value for "query_operator", must be one of AND, OR' end if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator']) fail ArgumentError, 'invalid value for "filter_operator", must be one of AND, OR' end if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval']) fail ArgumentError, 'invalid value for "facets_interval", must be one of year, month, week, day' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CountriesApi.get_countries, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CountriesApi.get_countries, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0 fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling CountriesApi.get_countries, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile']) fail ArgumentError, 'invalid value for "profile", must be one of full, list, minimal' end if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset']) fail ArgumentError, 'invalid value for "preset", must be one of analysis, latest, minimal' end # resource path local_var_path = '/countries' # query parameters query_params = {} query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil? query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil? query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil? query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil? query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil? query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil? query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil? query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil? query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil? query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil? query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil? query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil? query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil? query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil? query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil? query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil? query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil? query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Country') if @api_client.config.debugging @api_client.config.logger.debug "API called: CountriesApi#get_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_country_by_id(country_id, opts = {}) ⇒ Country
Find country by its unique ID Individual countries
168 169 170 171 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 168 def get_country_by_id(country_id, opts = {}) data, _status_code, _headers = get_country_by_id_with_http_info(country_id, opts) data end |
#get_country_by_id_with_http_info(country_id, opts = {}) ⇒ Array<(Country, Fixnum, Hash)>
Find country by its unique ID Individual countries
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 181 def get_country_by_id_with_http_info(country_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CountriesApi.get_country_by_id ...' end # verify the required parameter 'country_id' is set if @api_client.config.client_side_validation && country_id.nil? fail ArgumentError, "Missing the required parameter 'country_id' when calling CountriesApi.get_country_by_id" end if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile']) fail ArgumentError, 'invalid value for "profile", must be one of full, list, minimal' end # resource path local_var_path = '/countries/{countryId}'.sub('{' + 'countryId' + '}', country_id.to_s) # query parameters query_params = {} query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil? query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil? query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8', 'application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Country') if @api_client.config.debugging @api_client.config.logger.debug "API called: CountriesApi#get_country_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_countries(opts = {}) ⇒ Country
List or search countries covered by ReliefWeb.
231 232 233 234 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 231 def search_countries(opts = {}) data, _status_code, _headers = search_countries_with_http_info(opts) data end |
#search_countries_with_http_info(opts = {}) ⇒ Array<(Country, Fixnum, Hash)>
List or search countries covered by ReliefWeb.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/reliefweb-api/api/countries_api.rb', line 241 def search_countries_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CountriesApi.search_countries ...' end # resource path local_var_path = '/countries' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'fields']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Country') if @api_client.config.debugging @api_client.config.logger.debug "API called: CountriesApi#search_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |