reliefweb-api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +163 -0
- data/Rakefile +8 -0
- data/config.json +8 -0
- data/docs/Category.md +9 -0
- data/docs/CountriesApi.md +202 -0
- data/docs/Country.md +12 -0
- data/docs/Date.md +10 -0
- data/docs/Disaster.md +20 -0
- data/docs/DisastersApi.md +202 -0
- data/docs/DiscoveryApi.md +88 -0
- data/docs/Error.md +9 -0
- data/docs/ErrorDefinition.md +7 -0
- data/docs/FacetsFieldPost.md +7 -0
- data/docs/FacetsFilterPost.md +7 -0
- data/docs/FacetsIntervalPost.md +7 -0
- data/docs/FacetsLimitPost.md +7 -0
- data/docs/FacetsNamePost.md +7 -0
- data/docs/FacetsSortPost.md +7 -0
- data/docs/FieldsExcludePost.md +7 -0
- data/docs/FieldsIncludePost.md +7 -0
- data/docs/File.md +12 -0
- data/docs/FilterConditionsPost.md +7 -0
- data/docs/FilterFieldPost.md +7 -0
- data/docs/FilterNegatePost.md +7 -0
- data/docs/FilterOperatorPost.md +7 -0
- data/docs/FilterValuePost.md +7 -0
- data/docs/Job.md +23 -0
- data/docs/JobsApi.md +202 -0
- data/docs/Language.md +10 -0
- data/docs/LimitPost.md +7 -0
- data/docs/Location.md +8 -0
- data/docs/OffsetPost.md +7 -0
- data/docs/PostParams.md +28 -0
- data/docs/PresetPost.md +7 -0
- data/docs/ProfilePost.md +7 -0
- data/docs/QueryFieldsPost.md +7 -0
- data/docs/QueryOperatorPost.md +7 -0
- data/docs/QueryValuePost.md +7 -0
- data/docs/Report.md +19 -0
- data/docs/ReportsApi.md +202 -0
- data/docs/SortPost.md +7 -0
- data/docs/Source.md +14 -0
- data/docs/SourcesApi.md +202 -0
- data/docs/Training.md +23 -0
- data/docs/TrainingApi.md +202 -0
- data/git_push.sh +55 -0
- data/lib/reliefweb-api.rb +81 -0
- data/lib/reliefweb-api/api/countries_api.rb +277 -0
- data/lib/reliefweb-api/api/disasters_api.rb +277 -0
- data/lib/reliefweb-api/api/discovery_api.rb +113 -0
- data/lib/reliefweb-api/api/jobs_api.rb +277 -0
- data/lib/reliefweb-api/api/reports_api.rb +277 -0
- data/lib/reliefweb-api/api/sources_api.rb +277 -0
- data/lib/reliefweb-api/api/training_api.rb +277 -0
- data/lib/reliefweb-api/api_client.rb +388 -0
- data/lib/reliefweb-api/api_error.rb +38 -0
- data/lib/reliefweb-api/configuration.rb +202 -0
- data/lib/reliefweb-api/models/category.rb +192 -0
- data/lib/reliefweb-api/models/country.rb +220 -0
- data/lib/reliefweb-api/models/date.rb +202 -0
- data/lib/reliefweb-api/models/disaster.rb +299 -0
- data/lib/reliefweb-api/models/error.rb +192 -0
- data/lib/reliefweb-api/models/error_definition.rb +174 -0
- data/lib/reliefweb-api/models/facets_field_post.rb +175 -0
- data/lib/reliefweb-api/models/facets_filter_post.rb +175 -0
- data/lib/reliefweb-api/models/facets_interval_post.rb +32 -0
- data/lib/reliefweb-api/models/facets_limit_post.rb +175 -0
- data/lib/reliefweb-api/models/facets_name_post.rb +175 -0
- data/lib/reliefweb-api/models/facets_sort_post.rb +175 -0
- data/lib/reliefweb-api/models/fields_exclude_post.rb +175 -0
- data/lib/reliefweb-api/models/fields_include_post.rb +175 -0
- data/lib/reliefweb-api/models/file.rb +219 -0
- data/lib/reliefweb-api/models/filter_conditions_post.rb +175 -0
- data/lib/reliefweb-api/models/filter_field_post.rb +175 -0
- data/lib/reliefweb-api/models/filter_negate_post.rb +175 -0
- data/lib/reliefweb-api/models/filter_operator_post.rb +30 -0
- data/lib/reliefweb-api/models/filter_value_post.rb +175 -0
- data/lib/reliefweb-api/models/job.rb +330 -0
- data/lib/reliefweb-api/models/language.rb +201 -0
- data/lib/reliefweb-api/models/limit_post.rb +175 -0
- data/lib/reliefweb-api/models/location.rb +183 -0
- data/lib/reliefweb-api/models/offset_post.rb +175 -0
- data/lib/reliefweb-api/models/post_params.rb +363 -0
- data/lib/reliefweb-api/models/preset_post.rb +31 -0
- data/lib/reliefweb-api/models/profile_post.rb +31 -0
- data/lib/reliefweb-api/models/query_fields_post.rb +175 -0
- data/lib/reliefweb-api/models/query_operator_post.rb +30 -0
- data/lib/reliefweb-api/models/query_value_post.rb +175 -0
- data/lib/reliefweb-api/models/report.rb +293 -0
- data/lib/reliefweb-api/models/sort_post.rb +175 -0
- data/lib/reliefweb-api/models/source.rb +237 -0
- data/lib/reliefweb-api/models/training.rb +330 -0
- data/lib/reliefweb-api/version.rb +15 -0
- data/reliefweb-api.gemspec +45 -0
- data/spec/api/countries_api_spec.rb +94 -0
- data/spec/api/disasters_api_spec.rb +94 -0
- data/spec/api/discovery_api_spec.rb +55 -0
- data/spec/api/jobs_api_spec.rb +94 -0
- data/spec/api/reports_api_spec.rb +94 -0
- data/spec/api/sources_api_spec.rb +94 -0
- data/spec/api/training_api_spec.rb +94 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/category_spec.rb +47 -0
- data/spec/models/country_spec.rb +65 -0
- data/spec/models/date_spec.rb +53 -0
- data/spec/models/disaster_spec.rb +113 -0
- data/spec/models/error_definition_spec.rb +35 -0
- data/spec/models/error_spec.rb +47 -0
- data/spec/models/facets_field_post_spec.rb +35 -0
- data/spec/models/facets_filter_post_spec.rb +35 -0
- data/spec/models/facets_interval_post_spec.rb +35 -0
- data/spec/models/facets_limit_post_spec.rb +35 -0
- data/spec/models/facets_name_post_spec.rb +35 -0
- data/spec/models/facets_sort_post_spec.rb +35 -0
- data/spec/models/fields_exclude_post_spec.rb +35 -0
- data/spec/models/fields_include_post_spec.rb +35 -0
- data/spec/models/file_spec.rb +65 -0
- data/spec/models/filter_conditions_post_spec.rb +35 -0
- data/spec/models/filter_field_post_spec.rb +35 -0
- data/spec/models/filter_negate_post_spec.rb +35 -0
- data/spec/models/filter_operator_post_spec.rb +35 -0
- data/spec/models/filter_value_post_spec.rb +35 -0
- data/spec/models/job_spec.rb +131 -0
- data/spec/models/language_spec.rb +53 -0
- data/spec/models/limit_post_spec.rb +35 -0
- data/spec/models/location_spec.rb +41 -0
- data/spec/models/offset_post_spec.rb +35 -0
- data/spec/models/post_params_spec.rb +161 -0
- data/spec/models/preset_post_spec.rb +35 -0
- data/spec/models/profile_post_spec.rb +35 -0
- data/spec/models/query_fields_post_spec.rb +35 -0
- data/spec/models/query_operator_post_spec.rb +35 -0
- data/spec/models/query_value_post_spec.rb +35 -0
- data/spec/models/report_spec.rb +107 -0
- data/spec/models/sort_post_spec.rb +35 -0
- data/spec/models/source_spec.rb +77 -0
- data/spec/models/training_spec.rb +131 -0
- data/spec/spec_helper.rb +111 -0
- metadata +416 -0
@@ -0,0 +1,175 @@
|
|
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 'date'
|
14
|
+
|
15
|
+
module ReliefWebAPI
|
16
|
+
# This property is used to combine conditions with a logical connector (the <code>operator</code> property). Every condition must contain one of the <code>field</code> or <code>conditions</code> properties.
|
17
|
+
class FilterConditionsPost
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Attribute type mapping.
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Initializes the object
|
31
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return unless attributes.is_a?(Hash)
|
34
|
+
|
35
|
+
# convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
40
|
+
# @return Array for valid properties with the reasons
|
41
|
+
def list_invalid_properties
|
42
|
+
invalid_properties = Array.new
|
43
|
+
invalid_properties
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check to see if the all the properties in the model are valid
|
47
|
+
# @return true if the model is valid
|
48
|
+
def valid?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Checks equality by comparing each attribute.
|
53
|
+
# @param [Object] Object to be compared
|
54
|
+
def ==(o)
|
55
|
+
return true if self.equal?(o)
|
56
|
+
self.class == o.class
|
57
|
+
end
|
58
|
+
|
59
|
+
# @see the `==` method
|
60
|
+
# @param [Object] Object to be compared
|
61
|
+
def eql?(o)
|
62
|
+
self == o
|
63
|
+
end
|
64
|
+
|
65
|
+
# Calculates hash code according to all attributes.
|
66
|
+
# @return [Fixnum] Hash code
|
67
|
+
def hash
|
68
|
+
[].hash
|
69
|
+
end
|
70
|
+
|
71
|
+
# Builds the object from hash
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
# @return [Object] Returns the model itself
|
74
|
+
def build_from_hash(attributes)
|
75
|
+
return nil unless attributes.is_a?(Hash)
|
76
|
+
self.class.swagger_types.each_pair do |key, type|
|
77
|
+
if type =~ /\AArray<(.*)>/i
|
78
|
+
# check to ensure the input is an array given that the the attribute
|
79
|
+
# is documented as an array but the input is not
|
80
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
81
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
82
|
+
end
|
83
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
84
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
85
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
86
|
+
end
|
87
|
+
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
# Deserializes the data based on type
|
92
|
+
# @param string type Data type
|
93
|
+
# @param string value Value to be deserialized
|
94
|
+
# @return [Object] Deserialized data
|
95
|
+
def _deserialize(type, value)
|
96
|
+
case type.to_sym
|
97
|
+
when :DateTime
|
98
|
+
DateTime.parse(value)
|
99
|
+
when :Date
|
100
|
+
Date.parse(value)
|
101
|
+
when :String
|
102
|
+
value.to_s
|
103
|
+
when :Integer
|
104
|
+
value.to_i
|
105
|
+
when :Float
|
106
|
+
value.to_f
|
107
|
+
when :BOOLEAN
|
108
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
109
|
+
true
|
110
|
+
else
|
111
|
+
false
|
112
|
+
end
|
113
|
+
when :Object
|
114
|
+
# generic object (usually a Hash), return directly
|
115
|
+
value
|
116
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
117
|
+
inner_type = Regexp.last_match[:inner_type]
|
118
|
+
value.map { |v| _deserialize(inner_type, v) }
|
119
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
120
|
+
k_type = Regexp.last_match[:k_type]
|
121
|
+
v_type = Regexp.last_match[:v_type]
|
122
|
+
{}.tap do |hash|
|
123
|
+
value.each do |k, v|
|
124
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else # model
|
128
|
+
temp_model = ReliefWebAPI.const_get(type).new
|
129
|
+
temp_model.build_from_hash(value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Returns the string representation of the object
|
134
|
+
# @return [String] String presentation of the object
|
135
|
+
def to_s
|
136
|
+
to_hash.to_s
|
137
|
+
end
|
138
|
+
|
139
|
+
# to_body is an alias to to_hash (backward compatibility)
|
140
|
+
# @return [Hash] Returns the object in the form of hash
|
141
|
+
def to_body
|
142
|
+
to_hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the object in the form of hash
|
146
|
+
# @return [Hash] Returns the object in the form of hash
|
147
|
+
def to_hash
|
148
|
+
hash = {}
|
149
|
+
self.class.attribute_map.each_pair do |attr, param|
|
150
|
+
value = self.send(attr)
|
151
|
+
next if value.nil?
|
152
|
+
hash[param] = _to_hash(value)
|
153
|
+
end
|
154
|
+
hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Outputs non-array value in the form of hash
|
158
|
+
# For object, use to_hash. Otherwise, just return the value
|
159
|
+
# @param [Object] value Any valid value
|
160
|
+
# @return [Hash] Returns the value in the form of hash
|
161
|
+
def _to_hash(value)
|
162
|
+
if value.is_a?(Array)
|
163
|
+
value.compact.map { |v| _to_hash(v) }
|
164
|
+
elsif value.is_a?(Hash)
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
167
|
+
end
|
168
|
+
elsif value.respond_to? :to_hash
|
169
|
+
value.to_hash
|
170
|
+
else
|
171
|
+
value
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,175 @@
|
|
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 'date'
|
14
|
+
|
15
|
+
module ReliefWebAPI
|
16
|
+
# Field to filter by. Every condition must contain either a <code>field</code> or <code>conditions</code> property.
|
17
|
+
class FilterFieldPost
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Attribute type mapping.
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Initializes the object
|
31
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return unless attributes.is_a?(Hash)
|
34
|
+
|
35
|
+
# convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
40
|
+
# @return Array for valid properties with the reasons
|
41
|
+
def list_invalid_properties
|
42
|
+
invalid_properties = Array.new
|
43
|
+
invalid_properties
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check to see if the all the properties in the model are valid
|
47
|
+
# @return true if the model is valid
|
48
|
+
def valid?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Checks equality by comparing each attribute.
|
53
|
+
# @param [Object] Object to be compared
|
54
|
+
def ==(o)
|
55
|
+
return true if self.equal?(o)
|
56
|
+
self.class == o.class
|
57
|
+
end
|
58
|
+
|
59
|
+
# @see the `==` method
|
60
|
+
# @param [Object] Object to be compared
|
61
|
+
def eql?(o)
|
62
|
+
self == o
|
63
|
+
end
|
64
|
+
|
65
|
+
# Calculates hash code according to all attributes.
|
66
|
+
# @return [Fixnum] Hash code
|
67
|
+
def hash
|
68
|
+
[].hash
|
69
|
+
end
|
70
|
+
|
71
|
+
# Builds the object from hash
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
# @return [Object] Returns the model itself
|
74
|
+
def build_from_hash(attributes)
|
75
|
+
return nil unless attributes.is_a?(Hash)
|
76
|
+
self.class.swagger_types.each_pair do |key, type|
|
77
|
+
if type =~ /\AArray<(.*)>/i
|
78
|
+
# check to ensure the input is an array given that the the attribute
|
79
|
+
# is documented as an array but the input is not
|
80
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
81
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
82
|
+
end
|
83
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
84
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
85
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
86
|
+
end
|
87
|
+
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
# Deserializes the data based on type
|
92
|
+
# @param string type Data type
|
93
|
+
# @param string value Value to be deserialized
|
94
|
+
# @return [Object] Deserialized data
|
95
|
+
def _deserialize(type, value)
|
96
|
+
case type.to_sym
|
97
|
+
when :DateTime
|
98
|
+
DateTime.parse(value)
|
99
|
+
when :Date
|
100
|
+
Date.parse(value)
|
101
|
+
when :String
|
102
|
+
value.to_s
|
103
|
+
when :Integer
|
104
|
+
value.to_i
|
105
|
+
when :Float
|
106
|
+
value.to_f
|
107
|
+
when :BOOLEAN
|
108
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
109
|
+
true
|
110
|
+
else
|
111
|
+
false
|
112
|
+
end
|
113
|
+
when :Object
|
114
|
+
# generic object (usually a Hash), return directly
|
115
|
+
value
|
116
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
117
|
+
inner_type = Regexp.last_match[:inner_type]
|
118
|
+
value.map { |v| _deserialize(inner_type, v) }
|
119
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
120
|
+
k_type = Regexp.last_match[:k_type]
|
121
|
+
v_type = Regexp.last_match[:v_type]
|
122
|
+
{}.tap do |hash|
|
123
|
+
value.each do |k, v|
|
124
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else # model
|
128
|
+
temp_model = ReliefWebAPI.const_get(type).new
|
129
|
+
temp_model.build_from_hash(value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Returns the string representation of the object
|
134
|
+
# @return [String] String presentation of the object
|
135
|
+
def to_s
|
136
|
+
to_hash.to_s
|
137
|
+
end
|
138
|
+
|
139
|
+
# to_body is an alias to to_hash (backward compatibility)
|
140
|
+
# @return [Hash] Returns the object in the form of hash
|
141
|
+
def to_body
|
142
|
+
to_hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the object in the form of hash
|
146
|
+
# @return [Hash] Returns the object in the form of hash
|
147
|
+
def to_hash
|
148
|
+
hash = {}
|
149
|
+
self.class.attribute_map.each_pair do |attr, param|
|
150
|
+
value = self.send(attr)
|
151
|
+
next if value.nil?
|
152
|
+
hash[param] = _to_hash(value)
|
153
|
+
end
|
154
|
+
hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Outputs non-array value in the form of hash
|
158
|
+
# For object, use to_hash. Otherwise, just return the value
|
159
|
+
# @param [Object] value Any valid value
|
160
|
+
# @return [Hash] Returns the value in the form of hash
|
161
|
+
def _to_hash(value)
|
162
|
+
if value.is_a?(Array)
|
163
|
+
value.compact.map { |v| _to_hash(v) }
|
164
|
+
elsif value.is_a?(Hash)
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
167
|
+
end
|
168
|
+
elsif value.respond_to? :to_hash
|
169
|
+
value.to_hash
|
170
|
+
else
|
171
|
+
value
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,175 @@
|
|
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 'date'
|
14
|
+
|
15
|
+
module ReliefWebAPI
|
16
|
+
# Reverse the filter to include those items that do not match.
|
17
|
+
class FilterNegatePost
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Attribute type mapping.
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Initializes the object
|
31
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return unless attributes.is_a?(Hash)
|
34
|
+
|
35
|
+
# convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
40
|
+
# @return Array for valid properties with the reasons
|
41
|
+
def list_invalid_properties
|
42
|
+
invalid_properties = Array.new
|
43
|
+
invalid_properties
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check to see if the all the properties in the model are valid
|
47
|
+
# @return true if the model is valid
|
48
|
+
def valid?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Checks equality by comparing each attribute.
|
53
|
+
# @param [Object] Object to be compared
|
54
|
+
def ==(o)
|
55
|
+
return true if self.equal?(o)
|
56
|
+
self.class == o.class
|
57
|
+
end
|
58
|
+
|
59
|
+
# @see the `==` method
|
60
|
+
# @param [Object] Object to be compared
|
61
|
+
def eql?(o)
|
62
|
+
self == o
|
63
|
+
end
|
64
|
+
|
65
|
+
# Calculates hash code according to all attributes.
|
66
|
+
# @return [Fixnum] Hash code
|
67
|
+
def hash
|
68
|
+
[].hash
|
69
|
+
end
|
70
|
+
|
71
|
+
# Builds the object from hash
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
# @return [Object] Returns the model itself
|
74
|
+
def build_from_hash(attributes)
|
75
|
+
return nil unless attributes.is_a?(Hash)
|
76
|
+
self.class.swagger_types.each_pair do |key, type|
|
77
|
+
if type =~ /\AArray<(.*)>/i
|
78
|
+
# check to ensure the input is an array given that the the attribute
|
79
|
+
# is documented as an array but the input is not
|
80
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
81
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
82
|
+
end
|
83
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
84
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
85
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
86
|
+
end
|
87
|
+
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
# Deserializes the data based on type
|
92
|
+
# @param string type Data type
|
93
|
+
# @param string value Value to be deserialized
|
94
|
+
# @return [Object] Deserialized data
|
95
|
+
def _deserialize(type, value)
|
96
|
+
case type.to_sym
|
97
|
+
when :DateTime
|
98
|
+
DateTime.parse(value)
|
99
|
+
when :Date
|
100
|
+
Date.parse(value)
|
101
|
+
when :String
|
102
|
+
value.to_s
|
103
|
+
when :Integer
|
104
|
+
value.to_i
|
105
|
+
when :Float
|
106
|
+
value.to_f
|
107
|
+
when :BOOLEAN
|
108
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
109
|
+
true
|
110
|
+
else
|
111
|
+
false
|
112
|
+
end
|
113
|
+
when :Object
|
114
|
+
# generic object (usually a Hash), return directly
|
115
|
+
value
|
116
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
117
|
+
inner_type = Regexp.last_match[:inner_type]
|
118
|
+
value.map { |v| _deserialize(inner_type, v) }
|
119
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
120
|
+
k_type = Regexp.last_match[:k_type]
|
121
|
+
v_type = Regexp.last_match[:v_type]
|
122
|
+
{}.tap do |hash|
|
123
|
+
value.each do |k, v|
|
124
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else # model
|
128
|
+
temp_model = ReliefWebAPI.const_get(type).new
|
129
|
+
temp_model.build_from_hash(value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Returns the string representation of the object
|
134
|
+
# @return [String] String presentation of the object
|
135
|
+
def to_s
|
136
|
+
to_hash.to_s
|
137
|
+
end
|
138
|
+
|
139
|
+
# to_body is an alias to to_hash (backward compatibility)
|
140
|
+
# @return [Hash] Returns the object in the form of hash
|
141
|
+
def to_body
|
142
|
+
to_hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the object in the form of hash
|
146
|
+
# @return [Hash] Returns the object in the form of hash
|
147
|
+
def to_hash
|
148
|
+
hash = {}
|
149
|
+
self.class.attribute_map.each_pair do |attr, param|
|
150
|
+
value = self.send(attr)
|
151
|
+
next if value.nil?
|
152
|
+
hash[param] = _to_hash(value)
|
153
|
+
end
|
154
|
+
hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Outputs non-array value in the form of hash
|
158
|
+
# For object, use to_hash. Otherwise, just return the value
|
159
|
+
# @param [Object] value Any valid value
|
160
|
+
# @return [Hash] Returns the value in the form of hash
|
161
|
+
def _to_hash(value)
|
162
|
+
if value.is_a?(Array)
|
163
|
+
value.compact.map { |v| _to_hash(v) }
|
164
|
+
elsif value.is_a?(Hash)
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
167
|
+
end
|
168
|
+
elsif value.respond_to? :to_hash
|
169
|
+
value.to_hash
|
170
|
+
else
|
171
|
+
value
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|