reliefweb-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +163 -0
  4. data/Rakefile +8 -0
  5. data/config.json +8 -0
  6. data/docs/Category.md +9 -0
  7. data/docs/CountriesApi.md +202 -0
  8. data/docs/Country.md +12 -0
  9. data/docs/Date.md +10 -0
  10. data/docs/Disaster.md +20 -0
  11. data/docs/DisastersApi.md +202 -0
  12. data/docs/DiscoveryApi.md +88 -0
  13. data/docs/Error.md +9 -0
  14. data/docs/ErrorDefinition.md +7 -0
  15. data/docs/FacetsFieldPost.md +7 -0
  16. data/docs/FacetsFilterPost.md +7 -0
  17. data/docs/FacetsIntervalPost.md +7 -0
  18. data/docs/FacetsLimitPost.md +7 -0
  19. data/docs/FacetsNamePost.md +7 -0
  20. data/docs/FacetsSortPost.md +7 -0
  21. data/docs/FieldsExcludePost.md +7 -0
  22. data/docs/FieldsIncludePost.md +7 -0
  23. data/docs/File.md +12 -0
  24. data/docs/FilterConditionsPost.md +7 -0
  25. data/docs/FilterFieldPost.md +7 -0
  26. data/docs/FilterNegatePost.md +7 -0
  27. data/docs/FilterOperatorPost.md +7 -0
  28. data/docs/FilterValuePost.md +7 -0
  29. data/docs/Job.md +23 -0
  30. data/docs/JobsApi.md +202 -0
  31. data/docs/Language.md +10 -0
  32. data/docs/LimitPost.md +7 -0
  33. data/docs/Location.md +8 -0
  34. data/docs/OffsetPost.md +7 -0
  35. data/docs/PostParams.md +28 -0
  36. data/docs/PresetPost.md +7 -0
  37. data/docs/ProfilePost.md +7 -0
  38. data/docs/QueryFieldsPost.md +7 -0
  39. data/docs/QueryOperatorPost.md +7 -0
  40. data/docs/QueryValuePost.md +7 -0
  41. data/docs/Report.md +19 -0
  42. data/docs/ReportsApi.md +202 -0
  43. data/docs/SortPost.md +7 -0
  44. data/docs/Source.md +14 -0
  45. data/docs/SourcesApi.md +202 -0
  46. data/docs/Training.md +23 -0
  47. data/docs/TrainingApi.md +202 -0
  48. data/git_push.sh +55 -0
  49. data/lib/reliefweb-api.rb +81 -0
  50. data/lib/reliefweb-api/api/countries_api.rb +277 -0
  51. data/lib/reliefweb-api/api/disasters_api.rb +277 -0
  52. data/lib/reliefweb-api/api/discovery_api.rb +113 -0
  53. data/lib/reliefweb-api/api/jobs_api.rb +277 -0
  54. data/lib/reliefweb-api/api/reports_api.rb +277 -0
  55. data/lib/reliefweb-api/api/sources_api.rb +277 -0
  56. data/lib/reliefweb-api/api/training_api.rb +277 -0
  57. data/lib/reliefweb-api/api_client.rb +388 -0
  58. data/lib/reliefweb-api/api_error.rb +38 -0
  59. data/lib/reliefweb-api/configuration.rb +202 -0
  60. data/lib/reliefweb-api/models/category.rb +192 -0
  61. data/lib/reliefweb-api/models/country.rb +220 -0
  62. data/lib/reliefweb-api/models/date.rb +202 -0
  63. data/lib/reliefweb-api/models/disaster.rb +299 -0
  64. data/lib/reliefweb-api/models/error.rb +192 -0
  65. data/lib/reliefweb-api/models/error_definition.rb +174 -0
  66. data/lib/reliefweb-api/models/facets_field_post.rb +175 -0
  67. data/lib/reliefweb-api/models/facets_filter_post.rb +175 -0
  68. data/lib/reliefweb-api/models/facets_interval_post.rb +32 -0
  69. data/lib/reliefweb-api/models/facets_limit_post.rb +175 -0
  70. data/lib/reliefweb-api/models/facets_name_post.rb +175 -0
  71. data/lib/reliefweb-api/models/facets_sort_post.rb +175 -0
  72. data/lib/reliefweb-api/models/fields_exclude_post.rb +175 -0
  73. data/lib/reliefweb-api/models/fields_include_post.rb +175 -0
  74. data/lib/reliefweb-api/models/file.rb +219 -0
  75. data/lib/reliefweb-api/models/filter_conditions_post.rb +175 -0
  76. data/lib/reliefweb-api/models/filter_field_post.rb +175 -0
  77. data/lib/reliefweb-api/models/filter_negate_post.rb +175 -0
  78. data/lib/reliefweb-api/models/filter_operator_post.rb +30 -0
  79. data/lib/reliefweb-api/models/filter_value_post.rb +175 -0
  80. data/lib/reliefweb-api/models/job.rb +330 -0
  81. data/lib/reliefweb-api/models/language.rb +201 -0
  82. data/lib/reliefweb-api/models/limit_post.rb +175 -0
  83. data/lib/reliefweb-api/models/location.rb +183 -0
  84. data/lib/reliefweb-api/models/offset_post.rb +175 -0
  85. data/lib/reliefweb-api/models/post_params.rb +363 -0
  86. data/lib/reliefweb-api/models/preset_post.rb +31 -0
  87. data/lib/reliefweb-api/models/profile_post.rb +31 -0
  88. data/lib/reliefweb-api/models/query_fields_post.rb +175 -0
  89. data/lib/reliefweb-api/models/query_operator_post.rb +30 -0
  90. data/lib/reliefweb-api/models/query_value_post.rb +175 -0
  91. data/lib/reliefweb-api/models/report.rb +293 -0
  92. data/lib/reliefweb-api/models/sort_post.rb +175 -0
  93. data/lib/reliefweb-api/models/source.rb +237 -0
  94. data/lib/reliefweb-api/models/training.rb +330 -0
  95. data/lib/reliefweb-api/version.rb +15 -0
  96. data/reliefweb-api.gemspec +45 -0
  97. data/spec/api/countries_api_spec.rb +94 -0
  98. data/spec/api/disasters_api_spec.rb +94 -0
  99. data/spec/api/discovery_api_spec.rb +55 -0
  100. data/spec/api/jobs_api_spec.rb +94 -0
  101. data/spec/api/reports_api_spec.rb +94 -0
  102. data/spec/api/sources_api_spec.rb +94 -0
  103. data/spec/api/training_api_spec.rb +94 -0
  104. data/spec/api_client_spec.rb +226 -0
  105. data/spec/configuration_spec.rb +42 -0
  106. data/spec/models/category_spec.rb +47 -0
  107. data/spec/models/country_spec.rb +65 -0
  108. data/spec/models/date_spec.rb +53 -0
  109. data/spec/models/disaster_spec.rb +113 -0
  110. data/spec/models/error_definition_spec.rb +35 -0
  111. data/spec/models/error_spec.rb +47 -0
  112. data/spec/models/facets_field_post_spec.rb +35 -0
  113. data/spec/models/facets_filter_post_spec.rb +35 -0
  114. data/spec/models/facets_interval_post_spec.rb +35 -0
  115. data/spec/models/facets_limit_post_spec.rb +35 -0
  116. data/spec/models/facets_name_post_spec.rb +35 -0
  117. data/spec/models/facets_sort_post_spec.rb +35 -0
  118. data/spec/models/fields_exclude_post_spec.rb +35 -0
  119. data/spec/models/fields_include_post_spec.rb +35 -0
  120. data/spec/models/file_spec.rb +65 -0
  121. data/spec/models/filter_conditions_post_spec.rb +35 -0
  122. data/spec/models/filter_field_post_spec.rb +35 -0
  123. data/spec/models/filter_negate_post_spec.rb +35 -0
  124. data/spec/models/filter_operator_post_spec.rb +35 -0
  125. data/spec/models/filter_value_post_spec.rb +35 -0
  126. data/spec/models/job_spec.rb +131 -0
  127. data/spec/models/language_spec.rb +53 -0
  128. data/spec/models/limit_post_spec.rb +35 -0
  129. data/spec/models/location_spec.rb +41 -0
  130. data/spec/models/offset_post_spec.rb +35 -0
  131. data/spec/models/post_params_spec.rb +161 -0
  132. data/spec/models/preset_post_spec.rb +35 -0
  133. data/spec/models/profile_post_spec.rb +35 -0
  134. data/spec/models/query_fields_post_spec.rb +35 -0
  135. data/spec/models/query_operator_post_spec.rb +35 -0
  136. data/spec/models/query_value_post_spec.rb +35 -0
  137. data/spec/models/report_spec.rb +107 -0
  138. data/spec/models/sort_post_spec.rb +35 -0
  139. data/spec/models/source_spec.rb +77 -0
  140. data/spec/models/training_spec.rb +131 -0
  141. data/spec/spec_helper.rb +111 -0
  142. metadata +416 -0
data/git_push.sh ADDED
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
+ #
7
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
8
+
9
+ git_user_id=$1
10
+ git_repo_id=$2
11
+ release_note=$3
12
+
13
+ if [ "$git_user_id" = "" ]; then
14
+ git_user_id="GIT_USER_ID"
15
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
+ fi
17
+
18
+ if [ "$git_repo_id" = "" ]; then
19
+ git_repo_id="GIT_REPO_ID"
20
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
+ fi
22
+
23
+ if [ "$release_note" = "" ]; then
24
+ release_note="Minor update"
25
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
+ fi
27
+
28
+ # Initialize the local directory as a Git repository
29
+ git init
30
+
31
+ # Adds the files in the local repository and stages them for commit.
32
+ git add .
33
+
34
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
+ git commit -m "$release_note"
36
+
37
+ # Sets the new remote
38
+ git_remote=`git remote`
39
+ if [ "$git_remote" = "" ]; then # git remote not defined
40
+
41
+ if [ "$GIT_TOKEN" = "" ]; then
42
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
+ else
45
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
+ fi
47
+
48
+ fi
49
+
50
+ git pull origin master
51
+
52
+ # Pushes (Forces) the changes in the local repository up to the remote repository
53
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
+ git push origin master 2>&1 | grep -v 'To https'
55
+
@@ -0,0 +1,81 @@
1
+ =begin
2
+ #The ReliefWeb API
3
+
4
+ #Interactive API documentation for the data API of Reliefweb.int. ReliefWeb is a leading source of information on global crises and disasters.<br><br> Our continuous coverage and archive going back to the 1970s makes ReliefWeb an unparalleled resource for both current and historical data on humanitarian response.<br><br> The vast majority of content on ReliefWeb has been contributed by humanitarian partners. We owe it to the community to make data more accessible and reusable, so that developers can build tools that increase exposure for valuable content and facilitate analysis for better decisions.
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: api@reliefweb.int
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'reliefweb-api/api_client'
15
+ require 'reliefweb-api/api_error'
16
+ require 'reliefweb-api/version'
17
+ require 'reliefweb-api/configuration'
18
+
19
+ # Models
20
+ require 'reliefweb-api/models/category'
21
+ require 'reliefweb-api/models/country'
22
+ require 'reliefweb-api/models/date'
23
+ require 'reliefweb-api/models/disaster'
24
+ require 'reliefweb-api/models/error'
25
+ require 'reliefweb-api/models/error_definition'
26
+ require 'reliefweb-api/models/facets_field_post'
27
+ require 'reliefweb-api/models/facets_filter_post'
28
+ require 'reliefweb-api/models/facets_interval_post'
29
+ require 'reliefweb-api/models/facets_limit_post'
30
+ require 'reliefweb-api/models/facets_name_post'
31
+ require 'reliefweb-api/models/facets_sort_post'
32
+ require 'reliefweb-api/models/fields_exclude_post'
33
+ require 'reliefweb-api/models/fields_include_post'
34
+ require 'reliefweb-api/models/file'
35
+ require 'reliefweb-api/models/filter_conditions_post'
36
+ require 'reliefweb-api/models/filter_field_post'
37
+ require 'reliefweb-api/models/filter_negate_post'
38
+ require 'reliefweb-api/models/filter_operator_post'
39
+ require 'reliefweb-api/models/filter_value_post'
40
+ require 'reliefweb-api/models/job'
41
+ require 'reliefweb-api/models/language'
42
+ require 'reliefweb-api/models/limit_post'
43
+ require 'reliefweb-api/models/location'
44
+ require 'reliefweb-api/models/offset_post'
45
+ require 'reliefweb-api/models/post_params'
46
+ require 'reliefweb-api/models/preset_post'
47
+ require 'reliefweb-api/models/profile_post'
48
+ require 'reliefweb-api/models/query_fields_post'
49
+ require 'reliefweb-api/models/query_operator_post'
50
+ require 'reliefweb-api/models/query_value_post'
51
+ require 'reliefweb-api/models/report'
52
+ require 'reliefweb-api/models/sort_post'
53
+ require 'reliefweb-api/models/source'
54
+ require 'reliefweb-api/models/training'
55
+
56
+ # APIs
57
+ require 'reliefweb-api/api/countries_api'
58
+ require 'reliefweb-api/api/disasters_api'
59
+ require 'reliefweb-api/api/discovery_api'
60
+ require 'reliefweb-api/api/jobs_api'
61
+ require 'reliefweb-api/api/reports_api'
62
+ require 'reliefweb-api/api/sources_api'
63
+ require 'reliefweb-api/api/training_api'
64
+
65
+ module ReliefWebAPI
66
+ class << self
67
+ # Customize default settings for the SDK using block.
68
+ # ReliefWebAPI.configure do |config|
69
+ # config.username = "xxx"
70
+ # config.password = "xxx"
71
+ # end
72
+ # If no block given, return the default Configuration object.
73
+ def configure
74
+ if block_given?
75
+ yield(Configuration.default)
76
+ else
77
+ Configuration.default
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,277 @@
1
+ =begin
2
+ #The ReliefWeb API
3
+
4
+ #Interactive API documentation for the data API of Reliefweb.int. ReliefWeb is a leading source of information on global crises and disasters.<br><br> Our continuous coverage and archive going back to the 1970s makes ReliefWeb an unparalleled resource for both current and historical data on humanitarian response.<br><br> The vast majority of content on ReliefWeb has been contributed by humanitarian partners. We owe it to the community to make data more accessible and reusable, so that developers can build tools that increase exposure for valuable content and facilitate analysis for better decisions.
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: api@reliefweb.int
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module ReliefWebAPI
16
+ class CountriesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List or search countries covered by ReliefWeb.
23
+ #
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :query_value Specify the terms of your fuzzy search. The default is no query.
26
+ # @option opts [String] :query_operator Specify the operator by which your search query words will be combined.
27
+ # @option opts [Array<String>] :query_fields Specify which fields to target with your search. You may use boost syntax here, see the Advanced API Usage documentation.
28
+ # @option opts [String] :filter_field Field to filter by. Every condition must contain either a &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; property.
29
+ # @option opts [Array<String>] :filter_value Value for the field being filtered. Leave blank to require existence of the field, must be present for &lt;code&gt;range&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt; conditions.
30
+ # @option opts [String] :filter_operator Operator by which filters will be combined.
31
+ # @option opts [BOOLEAN] :filter_negate Reverse the filter to include those items that do not match.
32
+ # @option opts [Array<String>] :filter_conditions This property is used to combine conditions with a logical connector (the &lt;code&gt;operator&lt;/code&gt; property). Every condition must contain one of the &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; properties.
33
+ # @option opts [String] :facets_field Field to facet by. May include dates, references or the status field.
34
+ # @option opts [String] :facets_name Identifier for resulting facet data. Useful when faceting multiple ways on the same field.
35
+ # @option opts [Integer] :facets_limit Limit the number of facets returned for non-date based facets.
36
+ # @option opts [String] :facets_sort The sort order of non-date facets. Sorting may be by &lt;code&gt;value&lt;/code&gt; or &lt;code&gt;count&lt;/code&gt; of terms, and ascending or descending. &lt;code&gt;count&lt;/code&gt; defaults to &lt;code&gt;desc&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; defaults to &lt;code&gt;asc&lt;/code&gt;.
37
+ # @option opts [Array<String>] :facets_filter Apply all the same capabilities of the filter parameter to the specific results of this facet request.
38
+ # @option opts [String] :facets_interval Round date information to the nearest interval unit. Apply all the same capabilities of the filter parameter to the specific results of this facet request.
39
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
40
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
41
+ # @option opts [Integer] :limit The maximum number of items to return for a list query. The default is &lt;code&gt;10&lt;/code&gt; and the maximum &lt;code&gt;1000&lt;/code&gt;. (default to 10)
42
+ # @option opts [Integer] :offset The offset from which to return the items in a list query. Allows paging through all results. The default is &lt;code&gt;0&lt;/code&gt;. (default to 0)
43
+ # @option opts [Array<String>] :sort Sort the list results. Defaults to search relevance. Values in the form of &lt;code&gt;fieldname:(asc|desc)&lt;/code&gt;.
44
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
45
+ # @option opts [String] :preset Pre-built standard configurations of queries, filters and sorts for common use cases.
46
+ # @return [Country]
47
+ def get_countries(opts = {})
48
+ data, _status_code, _headers = get_countries_with_http_info(opts)
49
+ data
50
+ end
51
+
52
+ # List or search countries covered by ReliefWeb.
53
+ #
54
+ # @param [Hash] opts the optional parameters
55
+ # @option opts [String] :query_value Specify the terms of your fuzzy search. The default is no query.
56
+ # @option opts [String] :query_operator Specify the operator by which your search query words will be combined.
57
+ # @option opts [Array<String>] :query_fields Specify which fields to target with your search. You may use boost syntax here, see the Advanced API Usage documentation.
58
+ # @option opts [String] :filter_field Field to filter by. Every condition must contain either a &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; property.
59
+ # @option opts [Array<String>] :filter_value Value for the field being filtered. Leave blank to require existence of the field, must be present for &lt;code&gt;range&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt; conditions.
60
+ # @option opts [String] :filter_operator Operator by which filters will be combined.
61
+ # @option opts [BOOLEAN] :filter_negate Reverse the filter to include those items that do not match.
62
+ # @option opts [Array<String>] :filter_conditions This property is used to combine conditions with a logical connector (the &lt;code&gt;operator&lt;/code&gt; property). Every condition must contain one of the &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; properties.
63
+ # @option opts [String] :facets_field Field to facet by. May include dates, references or the status field.
64
+ # @option opts [String] :facets_name Identifier for resulting facet data. Useful when faceting multiple ways on the same field.
65
+ # @option opts [Integer] :facets_limit Limit the number of facets returned for non-date based facets.
66
+ # @option opts [String] :facets_sort The sort order of non-date facets. Sorting may be by &lt;code&gt;value&lt;/code&gt; or &lt;code&gt;count&lt;/code&gt; of terms, and ascending or descending. &lt;code&gt;count&lt;/code&gt; defaults to &lt;code&gt;desc&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; defaults to &lt;code&gt;asc&lt;/code&gt;.
67
+ # @option opts [Array<String>] :facets_filter Apply all the same capabilities of the filter parameter to the specific results of this facet request.
68
+ # @option opts [String] :facets_interval Round date information to the nearest interval unit. Apply all the same capabilities of the filter parameter to the specific results of this facet request.
69
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
70
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
71
+ # @option opts [Integer] :limit The maximum number of items to return for a list query. The default is &lt;code&gt;10&lt;/code&gt; and the maximum &lt;code&gt;1000&lt;/code&gt;.
72
+ # @option opts [Integer] :offset The offset from which to return the items in a list query. Allows paging through all results. The default is &lt;code&gt;0&lt;/code&gt;.
73
+ # @option opts [Array<String>] :sort Sort the list results. Defaults to search relevance. Values in the form of &lt;code&gt;fieldname:(asc|desc)&lt;/code&gt;.
74
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
75
+ # @option opts [String] :preset Pre-built standard configurations of queries, filters and sorts for common use cases.
76
+ # @return [Array<(Country, Fixnum, Hash)>] Country data, response status code and response headers
77
+ def get_countries_with_http_info(opts = {})
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug 'Calling API: CountriesApi.get_countries ...'
80
+ end
81
+ if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])
82
+ fail ArgumentError, 'invalid value for "query_operator", must be one of AND, OR'
83
+ end
84
+ if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])
85
+ fail ArgumentError, 'invalid value for "filter_operator", must be one of AND, OR'
86
+ end
87
+ if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])
88
+ fail ArgumentError, 'invalid value for "facets_interval", must be one of year, month, week, day'
89
+ end
90
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
91
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CountriesApi.get_countries, must be smaller than or equal to 1000.'
92
+ end
93
+
94
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
95
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CountriesApi.get_countries, must be greater than or equal to 1.'
96
+ end
97
+
98
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
99
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling CountriesApi.get_countries, must be greater than or equal to 0.'
100
+ end
101
+
102
+ if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])
103
+ fail ArgumentError, 'invalid value for "profile", must be one of full, list, minimal'
104
+ end
105
+ if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])
106
+ fail ArgumentError, 'invalid value for "preset", must be one of analysis, latest, minimal'
107
+ end
108
+ # resource path
109
+ local_var_path = '/countries'
110
+
111
+ # query parameters
112
+ query_params = {}
113
+ query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?
114
+ query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?
115
+ query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?
116
+ query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?
117
+ query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?
118
+ query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?
119
+ query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?
120
+ query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?
121
+ query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?
122
+ query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?
123
+ query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?
124
+ query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?
125
+ query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?
126
+ query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?
127
+ query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?
128
+ query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?
129
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
130
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
131
+ query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?
132
+ query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?
133
+ query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil?
134
+
135
+ # header parameters
136
+ header_params = {}
137
+ # HTTP header 'Accept' (if needed)
138
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
139
+ # HTTP header 'Content-Type'
140
+ header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8'])
141
+
142
+ # form parameters
143
+ form_params = {}
144
+
145
+ # http body (model)
146
+ post_body = nil
147
+ auth_names = []
148
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
149
+ :header_params => header_params,
150
+ :query_params => query_params,
151
+ :form_params => form_params,
152
+ :body => post_body,
153
+ :auth_names => auth_names,
154
+ :return_type => 'Country')
155
+ if @api_client.config.debugging
156
+ @api_client.config.logger.debug "API called: CountriesApi#get_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
157
+ end
158
+ return data, status_code, headers
159
+ end
160
+ # Find country by its unique ID
161
+ # Individual countries
162
+ # @param country_id The identifier of the country
163
+ # @param [Hash] opts the optional parameters
164
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
165
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
166
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
167
+ # @return [Country]
168
+ def get_country_by_id(country_id, opts = {})
169
+ data, _status_code, _headers = get_country_by_id_with_http_info(country_id, opts)
170
+ data
171
+ end
172
+
173
+ # Find country by its unique ID
174
+ # Individual countries
175
+ # @param country_id The identifier of the country
176
+ # @param [Hash] opts the optional parameters
177
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
178
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
179
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
180
+ # @return [Array<(Country, Fixnum, Hash)>] Country data, response status code and response headers
181
+ def get_country_by_id_with_http_info(country_id, opts = {})
182
+ if @api_client.config.debugging
183
+ @api_client.config.logger.debug 'Calling API: CountriesApi.get_country_by_id ...'
184
+ end
185
+ # verify the required parameter 'country_id' is set
186
+ if @api_client.config.client_side_validation && country_id.nil?
187
+ fail ArgumentError, "Missing the required parameter 'country_id' when calling CountriesApi.get_country_by_id"
188
+ end
189
+ if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])
190
+ fail ArgumentError, 'invalid value for "profile", must be one of full, list, minimal'
191
+ end
192
+ # resource path
193
+ local_var_path = '/countries/{countryId}'.sub('{' + 'countryId' + '}', country_id.to_s)
194
+
195
+ # query parameters
196
+ query_params = {}
197
+ query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?
198
+ query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?
199
+ query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?
200
+
201
+ # header parameters
202
+ header_params = {}
203
+ # HTTP header 'Accept' (if needed)
204
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
205
+ # HTTP header 'Content-Type'
206
+ header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8', 'application/json'])
207
+
208
+ # form parameters
209
+ form_params = {}
210
+
211
+ # http body (model)
212
+ post_body = nil
213
+ auth_names = []
214
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
215
+ :header_params => header_params,
216
+ :query_params => query_params,
217
+ :form_params => form_params,
218
+ :body => post_body,
219
+ :auth_names => auth_names,
220
+ :return_type => 'Country')
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: CountriesApi#get_country_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ return data, status_code, headers
225
+ end
226
+ # List or search countries covered by ReliefWeb.
227
+ #
228
+ # @param [Hash] opts the optional parameters
229
+ # @option opts [PostParams] :fields Returned fields
230
+ # @return [Country]
231
+ def search_countries(opts = {})
232
+ data, _status_code, _headers = search_countries_with_http_info(opts)
233
+ data
234
+ end
235
+
236
+ # List or search countries covered by ReliefWeb.
237
+ #
238
+ # @param [Hash] opts the optional parameters
239
+ # @option opts [PostParams] :fields Returned fields
240
+ # @return [Array<(Country, Fixnum, Hash)>] Country data, response status code and response headers
241
+ def search_countries_with_http_info(opts = {})
242
+ if @api_client.config.debugging
243
+ @api_client.config.logger.debug 'Calling API: CountriesApi.search_countries ...'
244
+ end
245
+ # resource path
246
+ local_var_path = '/countries'
247
+
248
+ # query parameters
249
+ query_params = {}
250
+
251
+ # header parameters
252
+ header_params = {}
253
+ # HTTP header 'Accept' (if needed)
254
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
255
+ # HTTP header 'Content-Type'
256
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
257
+
258
+ # form parameters
259
+ form_params = {}
260
+
261
+ # http body (model)
262
+ post_body = @api_client.object_to_http_body(opts[:'fields'])
263
+ auth_names = []
264
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
265
+ :header_params => header_params,
266
+ :query_params => query_params,
267
+ :form_params => form_params,
268
+ :body => post_body,
269
+ :auth_names => auth_names,
270
+ :return_type => 'Country')
271
+ if @api_client.config.debugging
272
+ @api_client.config.logger.debug "API called: CountriesApi#search_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
273
+ end
274
+ return data, status_code, headers
275
+ end
276
+ end
277
+ end
@@ -0,0 +1,277 @@
1
+ =begin
2
+ #The ReliefWeb API
3
+
4
+ #Interactive API documentation for the data API of Reliefweb.int. ReliefWeb is a leading source of information on global crises and disasters.<br><br> Our continuous coverage and archive going back to the 1970s makes ReliefWeb an unparalleled resource for both current and historical data on humanitarian response.<br><br> The vast majority of content on ReliefWeb has been contributed by humanitarian partners. We owe it to the community to make data more accessible and reusable, so that developers can build tools that increase exposure for valuable content and facilitate analysis for better decisions.
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: api@reliefweb.int
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module ReliefWebAPI
16
+ class DisastersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Find disaster by its unique ID
23
+ # Individual disasters
24
+ # @param disaster_id The identifier of the disaster
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
27
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
28
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
29
+ # @return [Disaster]
30
+ def get_disaster_by_id(disaster_id, opts = {})
31
+ data, _status_code, _headers = get_disaster_by_id_with_http_info(disaster_id, opts)
32
+ data
33
+ end
34
+
35
+ # Find disaster by its unique ID
36
+ # Individual disasters
37
+ # @param disaster_id The identifier of the disaster
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
40
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
41
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
42
+ # @return [Array<(Disaster, Fixnum, Hash)>] Disaster data, response status code and response headers
43
+ def get_disaster_by_id_with_http_info(disaster_id, opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: DisastersApi.get_disaster_by_id ...'
46
+ end
47
+ # verify the required parameter 'disaster_id' is set
48
+ if @api_client.config.client_side_validation && disaster_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'disaster_id' when calling DisastersApi.get_disaster_by_id"
50
+ end
51
+ if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])
52
+ fail ArgumentError, 'invalid value for "profile", must be one of full, list, minimal'
53
+ end
54
+ # resource path
55
+ local_var_path = '/disasters/{disasterId}'.sub('{' + 'disasterId' + '}', disaster_id.to_s)
56
+
57
+ # query parameters
58
+ query_params = {}
59
+ query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?
60
+ query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?
61
+ query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?
62
+
63
+ # header parameters
64
+ header_params = {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
67
+ # HTTP header 'Content-Type'
68
+ header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8', 'application/json'])
69
+
70
+ # form parameters
71
+ form_params = {}
72
+
73
+ # http body (model)
74
+ post_body = nil
75
+ auth_names = []
76
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => 'Disaster')
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: DisastersApi#get_disaster_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ return data, status_code, headers
87
+ end
88
+ # List or search disasters covered by ReliefWeb.
89
+ #
90
+ # @param [Hash] opts the optional parameters
91
+ # @option opts [String] :query_value Specify the terms of your fuzzy search. The default is no query.
92
+ # @option opts [String] :query_operator Specify the operator by which your search query words will be combined.
93
+ # @option opts [Array<String>] :query_fields Specify which fields to target with your search. You may use boost syntax here, see the Advanced API Usage documentation.
94
+ # @option opts [String] :filter_field Field to filter by. Every condition must contain either a &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; property.
95
+ # @option opts [Array<String>] :filter_value Value for the field being filtered. Leave blank to require existence of the field, must be present for &lt;code&gt;range&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt; conditions.
96
+ # @option opts [String] :filter_operator Operator by which filters will be combined.
97
+ # @option opts [BOOLEAN] :filter_negate Reverse the filter to include those items that do not match.
98
+ # @option opts [Array<String>] :filter_conditions This property is used to combine conditions with a logical connector (the &lt;code&gt;operator&lt;/code&gt; property). Every condition must contain one of the &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; properties.
99
+ # @option opts [String] :facets_field Field to facet by. May include dates, references or the status field.
100
+ # @option opts [String] :facets_name Identifier for resulting facet data. Useful when faceting multiple ways on the same field.
101
+ # @option opts [Integer] :facets_limit Limit the number of facets returned for non-date based facets.
102
+ # @option opts [String] :facets_sort The sort order of non-date facets. Sorting may be by &lt;code&gt;value&lt;/code&gt; or &lt;code&gt;count&lt;/code&gt; of terms, and ascending or descending. &lt;code&gt;count&lt;/code&gt; defaults to &lt;code&gt;desc&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; defaults to &lt;code&gt;asc&lt;/code&gt;.
103
+ # @option opts [Array<String>] :facets_filter Apply all the same capabilities of the filter parameter to the specific results of this facet request.
104
+ # @option opts [String] :facets_interval Round date information to the nearest interval unit. Apply all the same capabilities of the filter parameter to the specific results of this facet request.
105
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
106
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
107
+ # @option opts [Integer] :limit The maximum number of items to return for a list query. The default is &lt;code&gt;10&lt;/code&gt; and the maximum &lt;code&gt;1000&lt;/code&gt;. (default to 10)
108
+ # @option opts [Integer] :offset The offset from which to return the items in a list query. Allows paging through all results. The default is &lt;code&gt;0&lt;/code&gt;. (default to 0)
109
+ # @option opts [Array<String>] :sort Sort the list results. Defaults to search relevance. Values in the form of &lt;code&gt;fieldname:(asc|desc)&lt;/code&gt;.
110
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
111
+ # @option opts [String] :preset Pre-built standard configurations of queries, filters and sorts for common use cases.
112
+ # @return [Disaster]
113
+ def get_disasters(opts = {})
114
+ data, _status_code, _headers = get_disasters_with_http_info(opts)
115
+ data
116
+ end
117
+
118
+ # List or search disasters covered by ReliefWeb.
119
+ #
120
+ # @param [Hash] opts the optional parameters
121
+ # @option opts [String] :query_value Specify the terms of your fuzzy search. The default is no query.
122
+ # @option opts [String] :query_operator Specify the operator by which your search query words will be combined.
123
+ # @option opts [Array<String>] :query_fields Specify which fields to target with your search. You may use boost syntax here, see the Advanced API Usage documentation.
124
+ # @option opts [String] :filter_field Field to filter by. Every condition must contain either a &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; property.
125
+ # @option opts [Array<String>] :filter_value Value for the field being filtered. Leave blank to require existence of the field, must be present for &lt;code&gt;range&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt; conditions.
126
+ # @option opts [String] :filter_operator Operator by which filters will be combined.
127
+ # @option opts [BOOLEAN] :filter_negate Reverse the filter to include those items that do not match.
128
+ # @option opts [Array<String>] :filter_conditions This property is used to combine conditions with a logical connector (the &lt;code&gt;operator&lt;/code&gt; property). Every condition must contain one of the &lt;code&gt;field&lt;/code&gt; or &lt;code&gt;conditions&lt;/code&gt; properties.
129
+ # @option opts [String] :facets_field Field to facet by. May include dates, references or the status field.
130
+ # @option opts [String] :facets_name Identifier for resulting facet data. Useful when faceting multiple ways on the same field.
131
+ # @option opts [Integer] :facets_limit Limit the number of facets returned for non-date based facets.
132
+ # @option opts [String] :facets_sort The sort order of non-date facets. Sorting may be by &lt;code&gt;value&lt;/code&gt; or &lt;code&gt;count&lt;/code&gt; of terms, and ascending or descending. &lt;code&gt;count&lt;/code&gt; defaults to &lt;code&gt;desc&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt; defaults to &lt;code&gt;asc&lt;/code&gt;.
133
+ # @option opts [Array<String>] :facets_filter Apply all the same capabilities of the filter parameter to the specific results of this facet request.
134
+ # @option opts [String] :facets_interval Round date information to the nearest interval unit. Apply all the same capabilities of the filter parameter to the specific results of this facet request.
135
+ # @option opts [Array<String>] :fields_include Specify which fields to include for each item. Defaults to an item label.
136
+ # @option opts [Array<String>] :fields_exclude Specify sub-fields to exclude from overall results. For example, if you include &lt;code&gt;date&lt;/code&gt; you may exclude &lt;code&gt;date.changed&lt;/code&gt;.
137
+ # @option opts [Integer] :limit The maximum number of items to return for a list query. The default is &lt;code&gt;10&lt;/code&gt; and the maximum &lt;code&gt;1000&lt;/code&gt;.
138
+ # @option opts [Integer] :offset The offset from which to return the items in a list query. Allows paging through all results. The default is &lt;code&gt;0&lt;/code&gt;.
139
+ # @option opts [Array<String>] :sort Sort the list results. Defaults to search relevance. Values in the form of &lt;code&gt;fieldname:(asc|desc)&lt;/code&gt;.
140
+ # @option opts [String] :profile Pre-built standard selections of fields to return for ease of displaying lists or items.
141
+ # @option opts [String] :preset Pre-built standard configurations of queries, filters and sorts for common use cases.
142
+ # @return [Array<(Disaster, Fixnum, Hash)>] Disaster data, response status code and response headers
143
+ def get_disasters_with_http_info(opts = {})
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug 'Calling API: DisastersApi.get_disasters ...'
146
+ end
147
+ if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])
148
+ fail ArgumentError, 'invalid value for "query_operator", must be one of AND, OR'
149
+ end
150
+ if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])
151
+ fail ArgumentError, 'invalid value for "filter_operator", must be one of AND, OR'
152
+ end
153
+ if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])
154
+ fail ArgumentError, 'invalid value for "facets_interval", must be one of year, month, week, day'
155
+ end
156
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
157
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DisastersApi.get_disasters, must be smaller than or equal to 1000.'
158
+ end
159
+
160
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
161
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DisastersApi.get_disasters, must be greater than or equal to 1.'
162
+ end
163
+
164
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
165
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling DisastersApi.get_disasters, must be greater than or equal to 0.'
166
+ end
167
+
168
+ if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])
169
+ fail ArgumentError, 'invalid value for "profile", must be one of full, list, minimal'
170
+ end
171
+ if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])
172
+ fail ArgumentError, 'invalid value for "preset", must be one of analysis, latest, minimal'
173
+ end
174
+ # resource path
175
+ local_var_path = '/disasters'
176
+
177
+ # query parameters
178
+ query_params = {}
179
+ query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?
180
+ query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?
181
+ query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?
182
+ query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?
183
+ query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?
184
+ query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?
185
+ query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?
186
+ query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?
187
+ query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?
188
+ query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?
189
+ query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?
190
+ query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?
191
+ query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?
192
+ query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?
193
+ query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?
194
+ query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?
195
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
196
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
197
+ query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?
198
+ query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?
199
+ query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil?
200
+
201
+ # header parameters
202
+ header_params = {}
203
+ # HTTP header 'Accept' (if needed)
204
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
205
+ # HTTP header 'Content-Type'
206
+ header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8'])
207
+
208
+ # form parameters
209
+ form_params = {}
210
+
211
+ # http body (model)
212
+ post_body = nil
213
+ auth_names = []
214
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
215
+ :header_params => header_params,
216
+ :query_params => query_params,
217
+ :form_params => form_params,
218
+ :body => post_body,
219
+ :auth_names => auth_names,
220
+ :return_type => 'Disaster')
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: DisastersApi#get_disasters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ return data, status_code, headers
225
+ end
226
+ # List or search disasters covered by ReliefWeb.
227
+ #
228
+ # @param [Hash] opts the optional parameters
229
+ # @option opts [PostParams] :fields Returned fields
230
+ # @return [Disaster]
231
+ def search_disasters(opts = {})
232
+ data, _status_code, _headers = search_disasters_with_http_info(opts)
233
+ data
234
+ end
235
+
236
+ # List or search disasters covered by ReliefWeb.
237
+ #
238
+ # @param [Hash] opts the optional parameters
239
+ # @option opts [PostParams] :fields Returned fields
240
+ # @return [Array<(Disaster, Fixnum, Hash)>] Disaster data, response status code and response headers
241
+ def search_disasters_with_http_info(opts = {})
242
+ if @api_client.config.debugging
243
+ @api_client.config.logger.debug 'Calling API: DisastersApi.search_disasters ...'
244
+ end
245
+ # resource path
246
+ local_var_path = '/disasters'
247
+
248
+ # query parameters
249
+ query_params = {}
250
+
251
+ # header parameters
252
+ header_params = {}
253
+ # HTTP header 'Accept' (if needed)
254
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
255
+ # HTTP header 'Content-Type'
256
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
257
+
258
+ # form parameters
259
+ form_params = {}
260
+
261
+ # http body (model)
262
+ post_body = @api_client.object_to_http_body(opts[:'fields'])
263
+ auth_names = []
264
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
265
+ :header_params => header_params,
266
+ :query_params => query_params,
267
+ :form_params => form_params,
268
+ :body => post_body,
269
+ :auth_names => auth_names,
270
+ :return_type => 'Disaster')
271
+ if @api_client.config.debugging
272
+ @api_client.config.logger.debug "API called: DisastersApi#search_disasters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
273
+ end
274
+ return data, status_code, headers
275
+ end
276
+ end
277
+ end