Module: Nasturtium
- Extended by:
- Configuration
- Defined in:
- lib/nasturtium.rb,
lib/nasturtium/error.rb,
lib/nasturtium/request.rb,
lib/nasturtium/version.rb
Defined Under Namespace
Classes: BadGateway, BadRequest, Error, GatewayTimeout, InternalServerError, NotFound, Request, ServiceUnavailable
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.controlled_terms(taxon_id: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get controlled vocabulary terms.
-
.identifications(id: nil, current_taxon: nil, own_observation: nil, is_change: nil, taxon_active: nil, observation_taxon_active: nil, rank: nil, observation_rank: nil, user_id: nil, user_login: nil, current: nil, category: nil, place_id: nil, quality_grade: nil, taxon_id: nil, observation_taxon_id: nil, iconic_taxon_id: nil, observation_iconic_taxon_id: nil, rank_lowest: nil, rank_highest: nil, observation_rank_lowest: nil, observation_rank_highest: nil, without_taxon_id: nil, without_observation_taxon_id: nil, before: nil, after: nil, observation_created_before: nil, observation_created_after: nil, observed_before: nil, observed_after: nil, id_below: nil, id_above: nil, only_id: nil, order: nil, order_by: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get identifications.
-
.mapping(asset_type, zoom_level, x, y, return_json: false, color: nil, style: nil, tile_size: nil, q: nil, search_on: nil, id: nil, not_id: nil, acc: nil, captive: nil, endemic: nil, geo: nil, identified: nil, introduced: nil, mappable: nil, native: nil, out_of_range: nil, pcid: nil, photos: nil, popular: nil, sounds: nil, taxon_is_active: nil, threatened: nil, verifiable: nil, licensed: nil, photo_licensed: nil, photo_license: nil, sound_license: nil, ofv_datatype: nil, place_id: nil, project_id: nil, rank: nil, site_id: nil, taxon_id: nil, without_taxon_id: nil, taxon_name: nil, user_id: nil, user_login: nil, ident_user_id: nil, day: nil, month: nil, year: nil, term_id: nil, without_term_id: nil, term_value_id: nil, without_term_value_id: nil, acc_below: nil, acc_below_or_unknown: nil, acc_above: nil, before: nil, observed_on: nil, after: nil, created_before: nil, created_on: nil, created_after: nil, unobserved_by_user_id: nil, apply_project_rules_for: nil, conservation_status: nil, conservation_status_authority: nil, conservation_status_iucn: nil, geoprivacy: nil, taxon_geoprivacy: nil, rank_lowest: nil, rank_highest: nil, iconic_taxa: nil, id_below: nil, id_above: nil, identifications: nil, latitude: nil, longitude: nil, radius: nil, ne_latitude: nil, ne_longitude: nil, sw_latitude: nil, sw_longitude: nil, list_id: nil, not_in_project: nil, not_matching_project_rules_for: nil, quality_grade: nil, updated_since: nil, viewer_id: nil, reviewed: nil, locale: nil, preferred_place_id: nil, only_id: nil, ttl: nil, order: nil, order_by: nil, page: nil, per_page: nil, headers: false, verbose: false) ⇒ Binary, Hash
Get map tiling assets for observations.
-
.observations(subresource: nil, q: nil, search_on: nil, id: nil, not_id: nil, acc: nil, captive: nil, endemic: nil, geo: nil, identified: nil, introduced: nil, mappable: nil, native: nil, out_of_range: nil, pcid: nil, photos: nil, popular: nil, sounds: nil, taxon_is_active: nil, threatened: nil, verifiable: nil, licensed: nil, photo_licensed: nil, photo_license: nil, sound_license: nil, ofv_datatype: nil, place_id: nil, project_id: nil, rank: nil, site_id: nil, taxon_id: nil, without_taxon_id: nil, taxon_name: nil, user_id: nil, user_login: nil, ident_user_id: nil, day: nil, month: nil, year: nil, term_id: nil, without_term_id: nil, term_value_id: nil, without_term_value_id: nil, acc_below: nil, acc_below_or_unknown: nil, acc_above: nil, before: nil, observed_on: nil, after: nil, created_before: nil, created_on: nil, created_after: nil, unobserved_by_user_id: nil, apply_project_rules_for: nil, conservation_status: nil, conservation_status_authority: nil, conservation_status_iucn: nil, geoprivacy: nil, taxon_geoprivacy: nil, rank_lowest: nil, rank_highest: nil, iconic_taxa: nil, id_below: nil, id_above: nil, identifications: nil, latitude: nil, longitude: nil, radius: nil, ne_latitude: nil, ne_longitude: nil, sw_latitude: nil, sw_longitude: nil, list_id: nil, not_in_project: nil, not_matching_project_rules_for: nil, quality_grade: nil, updated_since: nil, viewer_id: nil, reviewed: nil, locale: nil, preferred_place_id: nil, only_id: nil, ttl: nil, order: nil, order_by: nil, page: nil, per_page: nil, headers: false, verbose: false) ⇒ Hash, Boolean
Get observations.
-
.places_autocomplete(q, order_by: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Suggest places.
-
.places_id(id, admin_level: nil, verbose: false) ⇒ Hash, Boolean
Get places.
- .places_nearby(ne_latitude, ne_longitude, sw_latitude, sw_longitude, name: nil, verbose: false) ⇒ Hash, Boolean
-
.posts(login: nil, project_id: nil, parent_id: nil, page: nil, per_page: nil, verbose: false) ⇒ Array, Boolean
Get journal posts.
-
.project_members(id, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get project members.
-
.projects(q: nil, autocomplete: nil, id: nil, not_id: nil, latitude: nil, longitude: nil, radius: nil, place_id: nil, featured: nil, noteworthy: nil, site_id: nil, rule_details: nil, type: nil, member_id: nil, has_params: nil, has_posts: nil, page: nil, per_page: nil, order_by: nil, verbose: false) ⇒ Hash, Boolean
TODO: Add tests Get projects.
-
.search(q: nil, sources: nil, place_id: nil, preferred_place_id: nil, locale: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Search places, projects, taxa, users.
-
.taxa(id: nil, q: nil, is_active: nil, taxon_id: nil, parent_id: nil, rank: nil, rank_level: nil, id_above: nil, id_below: nil, locale: nil, only_id: nil, all_names: nil, preferred_place_id: nil, order: nil, order_by: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Taxon search.
-
.taxa_autocomplete(q: nil, is_active: nil, taxon_id: nil, rank: nil, rank_level: nil, locale: nil, preferred_place_id: nil, all_names: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Taxon suggest.
-
.user(id, verbose: false) ⇒ Hash, Boolean
Get user.
-
.user_autocomplete(q, project_id: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get user suggestions.
-
.user_me(verbose: false) ⇒ Hash, Boolean
Get logged in user.
-
.user_projects(id, rule_details: nil, project_type: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get user’s projects.
Methods included from Configuration
Class Method Details
.controlled_terms(taxon_id: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get controlled vocabulary terms
40 41 42 43 44 45 46 47 |
# File 'lib/nasturtium.rb', line 40 def self.controlled_terms(taxon_id: nil, page: nil, per_page: nil, verbose: false) if taxon_id.nil? endpoint = 'controlled_terms' else endpoint = 'controlled_terms/for_taxon' end Request.new(endpoint: endpoint, taxon_id: taxon_id, page: page, per_page: per_page, verbose: verbose).perform end |
.identifications(id: nil, current_taxon: nil, own_observation: nil, is_change: nil, taxon_active: nil, observation_taxon_active: nil, rank: nil, observation_rank: nil, user_id: nil, user_login: nil, current: nil, category: nil, place_id: nil, quality_grade: nil, taxon_id: nil, observation_taxon_id: nil, iconic_taxon_id: nil, observation_iconic_taxon_id: nil, rank_lowest: nil, rank_highest: nil, observation_rank_lowest: nil, observation_rank_highest: nil, without_taxon_id: nil, without_observation_taxon_id: nil, before: nil, after: nil, observation_created_before: nil, observation_created_after: nil, observed_before: nil, observed_after: nil, id_below: nil, id_above: nil, only_id: nil, order: nil, order_by: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get identifications
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 |
# File 'lib/nasturtium.rb', line 91 def self.identifications(id: nil, current_taxon: nil, own_observation: nil, is_change: nil, taxon_active: nil, observation_taxon_active: nil, rank: nil, observation_rank: nil, user_id: nil, user_login: nil, current: nil, category: nil, place_id: nil, quality_grade: nil, taxon_id: nil, observation_taxon_id: nil, iconic_taxon_id: nil, observation_iconic_taxon_id: nil, rank_lowest: nil, rank_highest: nil, observation_rank_lowest: nil, observation_rank_highest: nil, without_taxon_id: nil, without_observation_taxon_id: nil, before: nil, after: nil, observation_created_before: nil, observation_created_after: nil, observed_before: nil, observed_after: nil, id_below: nil, id_above: nil, only_id: nil, order: nil, order_by: nil, page: nil, per_page: nil, verbose: false) endpoint = 'identifications' Request.new(endpoint: endpoint, id: id, current_taxon: current_taxon, own_observation: own_observation, is_change: is_change, taxon_active: taxon_active, observation_taxon_active: observation_taxon_active, rank: rank, observation_rank: observation_rank, user_id: user_id, user_login: user_login, current: current, category: category, place_id: place_id, quality_grade: quality_grade, taxon_id: taxon_id, observation_taxon_id: observation_taxon_id, iconic_taxon_id: iconic_taxon_id, observation_iconic_taxon_id: observation_iconic_taxon_id, rank_lowest: rank_lowest, rank_highest: rank_highest, observation_rank_lowest: observation_rank_lowest, observation_rank_highest: observation_rank_highest, without_taxon_id: without_taxon_id, without_observation_taxon_id: without_observation_taxon_id, before: before, after: after, observation_created_before: observation_created_before, observation_created_after: observation_created_after, observed_before: observed_before, observed_after: observed_after, id_below: id_below, id_above: id_above, only_id: only_id, order: order, order_by: order_by, page: page, per_page: per_page, verbose: verbose).perform end |
.mapping(asset_type, zoom_level, x, y, return_json: false, color: nil, style: nil, tile_size: nil, q: nil, search_on: nil, id: nil, not_id: nil, acc: nil, captive: nil, endemic: nil, geo: nil, identified: nil, introduced: nil, mappable: nil, native: nil, out_of_range: nil, pcid: nil, photos: nil, popular: nil, sounds: nil, taxon_is_active: nil, threatened: nil, verifiable: nil, licensed: nil, photo_licensed: nil, photo_license: nil, sound_license: nil, ofv_datatype: nil, place_id: nil, project_id: nil, rank: nil, site_id: nil, taxon_id: nil, without_taxon_id: nil, taxon_name: nil, user_id: nil, user_login: nil, ident_user_id: nil, day: nil, month: nil, year: nil, term_id: nil, without_term_id: nil, term_value_id: nil, without_term_value_id: nil, acc_below: nil, acc_below_or_unknown: nil, acc_above: nil, before: nil, observed_on: nil, after: nil, created_before: nil, created_on: nil, created_after: nil, unobserved_by_user_id: nil, apply_project_rules_for: nil, conservation_status: nil, conservation_status_authority: nil, conservation_status_iucn: nil, geoprivacy: nil, taxon_geoprivacy: nil, rank_lowest: nil, rank_highest: nil, iconic_taxa: nil, id_below: nil, id_above: nil, identifications: nil, latitude: nil, longitude: nil, radius: nil, ne_latitude: nil, ne_longitude: nil, sw_latitude: nil, sw_longitude: nil, list_id: nil, not_in_project: nil, not_matching_project_rules_for: nil, quality_grade: nil, updated_since: nil, viewer_id: nil, reviewed: nil, locale: nil, preferred_place_id: nil, only_id: nil, ttl: nil, order: nil, order_by: nil, page: nil, per_page: nil, headers: false, verbose: false) ⇒ Binary, Hash
Get map tiling assets for observations
Mapping-specific parameters:
@param asset_type [String] The type of asset to return [colored_heatmap, grid, heatmap, points, places, taxon_places, taxon_ranges]
@param return_json [Boolean] Whether to return UTFGRid (only use with asset_types: colored_heatmap, grid, heatmap, points)
@param color [String, nil] A color to use in map creation (e.g., blue, #0000ff)
@param style [String, nil] The map tile style (geotilegrid, possibly others)
@param tile_size [Integer, nil] The map tile size in pixels
All of the parameters for filtering observations are also available:
@param q [String, nil] An observation properties search query
@param search_on [String, nil] Observation properties to search on (names, tags, description, place)
@param id [String, Integer, nil] A comma-separated list of observation IDs
@param not_id [String, Integer, nil] A comma-separated list of observation IDs that must not be included
@param acc [Boolean, nil] Filter by whether the positional accuracy/coordinate uncertainty was specified
@param captive [Boolean, nil] Filter on whether it was captive/cultivated observations
@param endemic [Boolean, nil] Filter on whether observations were of taxa endemic to their location
@param geo [Boolean, nil] Filter to only georeferenced observations
@param identified [Boolean, nil] Filter to only observations with community identifications
@param introduced [Boolean, nil] Filter to observations of taxa that were introduced to their location
@param mappable [Boolean, nil] Filter to only observations that show on map tiles
@param native [Boolean, nil] Filter to only observations of taxa native tot heir location
@param out_of_range [Boolean, nil] Filter to only observations made in locations outside the taxon's known ranges
@param pcid [Boolean, nil] Filter to observations identified by a curator of a project
@param photos [Boolean, nil] Filter to observations with photos
@param popular [Boolean, nil] Filter to only observations that have been favorited by at least 1 user
@param sounds [Boolean, nil] Filter to observations with sounds
@param taxon_is_active [Boolean, nil] Filter to observations of active taxon concepts
@param threatened [Boolean, nil] Filter to observations of taxa that are threatened at their location
@param verifiable [Boolean, nil] Filter by observations with a quality_grade=needs_id,research
@param licensed [Boolean, nil] Filter by observations with a license
@param photo_licensed [Boolean, nil] License attribute of at least one photo in an observation must not be nil
@param license [String, nil] Filter by a comma-separated list of licenses (cc-by,cc-by-nc,cc-by-nd,cc-by-sa,cc-by-nc-nd,cc-by-nc-sa,cc0)
@param photo_license [String, nil] Filter by a comma-separated list of photo licenses (cc-by,cc-by-nc,cc-by-nd,cc-by-sa,cc-by-nc-nd,cc-by-nc-sa,cc0)
@param sound_license [String, nil] Filter by a comma-separated list of sound licenses (cc-by,cc-by-nc,cc-by-nd,cc-by-sa,cc-by-nc-nd,cc-by-nc-sa,cc0)
@param ofv_datatype [String, nil] Filter by a comma-separated list of datatypes that the observation must include # TODO: does it take arrays?
@param place_id [String, Integer, nil] Filter by a comma-separated list of place_ids
@param project_id [String, Integer, nil] Filter by a comma-separated list of project_ids
@param rank [String, nil] Filter by an array of taxon ranks
@param site_id [String, Integer, nil] Filter by a comma-separated list of site_ids
@param taxon_id [String, Integer, nil] Filter by a comma-separated list of taxon_ids and their descendants
@param without_taxon_id [String, Integer, nil] Exclude a comma-separated list of taxon_ids and their descendants
@param taxon_name [String, Integer, nil] Filter by a comma-separated list of scientific or common names
@param user_id [String, Integer nil] Filter by observations made by a comma-separated list of user_ids
@param user_login [String, nil] Filter by a comma-separated list of user_logins
@param ident_user_id [String, Integer, nil] Filter by observations identified by a particular user_id
@param day [String, Integer, nil] Filter on a comma-separated list of days
@param month [String, Integer, nil] Filter on a comma-separated list of months
@param year [String, Integer, nil] Filter on a comma-separated list of years
@param term_id [String, Integer, nil] Filter on a comma-separated list of term_ids
@param without_term_id String, Integer, nil] Exclude on a comma-separated list of term_ids
@param term_value_id [String, Integer, nil] Filter on annotations made with this controlled value ID; must be used with term_id
@param without_term_value_id [String, Integer, nil] Exclude on annotations made with this controlled value ID
@param acc_above [String, nil] Positional accuracy must be above value
@param acc_below [String, nil] Positional accuracy must be below value
@param acc_below_or_unknown [String, nil] Positional accuracy must be below value or unknown
@param before [String, nil] Must have been observed on or before this date (d2)
@param after [String, nil] Must have been observed on or after this date (d1)
@param observed_on [String, nil] Must have been observed on this date
@param created_before [String, nil] Must have been created on or before this date (created_d2)
@param created_on [String, nil] Must have been created on this date
@param created_after [String, nil] Must have been created on or before this date (created_d1)
@param unobserved_by_user_id [String, nil] Taxon must be unobserved by the provided user_id
@param apply_project_rules_for [String, nil] Must match rules of the provided project_id
@param conservation_status [String, nil] Taxon must have this conservation status (cs) code, use with place_id to make location-specific
@param conservation_status_authority [String, nil] Taxon must have the conservation status from the provided authority (csa), use with place_id to make location-specific
@param conservation_status_iucn [String, nil] Taxon must have the provided conservation status from the IUCN, use with place_id to make location-specific
@param geoprivacy [String, nil] Filter by a comma-separated list of geoprivacy settings (obscured, obscured_private, open)
@param taxon_geoprivacy [String, nil] Filter by a comma-separated list of geoprivacy settings (obscured, obscured_private, open) of the most conservative geoprivacy associated with one of the taxa proposed in the current identifications
@param rank_lowest [String, nil] Taxon rank must be less than or equal to provided rank
@param rank_highest [String, nil] Taxon rank must be greater than or equal to provided rank
@param iconic_taxa [String, nil] Filter by taxa with the provided iconic taxon (Actinopterygii, Animalia, Amphibia, Arachnida, Aves, Chromista, Fungi, Insecta, Mammalia, Mollusca, Repitilia, Plantae, Protozoa, unknown)
@param id_below [String, Integer, nil] Most have an observation ID below the provided value
@param id_above [String, Integer, nil] Most have an observation ID above the provided value
@param identifications [String, nil] Filter by identifications status (most_agree, some_agree, most_disagree)
@param latitude [Double, nil] Filter by observations within a {radius} kilometer circle around the provided latitude coordinate (lat)
@param longitude [Double, nil] Filter by observations within a {radius} kilometer circle around the provided longitude coordinate (lng)
@param radius [String, Integer, Double] Filter by observations within the provided radius in kilometers
@param ne_latitude [Double, nil] Filter by observations within provided (nelat) bounding box (ne_latitude, ne_longitude, sw_latitude, sw_longitude)
@param ne_longitude [Double, nil] Filter by observations within provided (nelng) bounding box (ne_latitude, ne_longitude, sw_latitude, sw_longitude)
@param sw_latitude [Double, nil] Filter by observations within provided (swlat) bounding box (ne_latitude, ne_longitude, sw_latitude, sw_longitude)
@param sw_longitude [Double, nil] Filter by observations within provided (swlng) bounding box (ne_latitude, ne_longitude, sw_latitude, sw_longitude)
@param list_id [Integer, nil] Taxon must bin the list with the provided ID
@param not_in_project [String, nil] Observation must not be in the provided project_id or slug
@param not_matching_project_rules_for [String, nil] Must not match the rules of the provided project_id or slug
@param quality_grade [String, nil] Filter by observation quality grade (casual, needs_id, research)
@param updated_since [String, nil] Filter by observations updated since the provided time
@param reviewed [Boolean, nil] Observations have been reviewed by viewer_id
@param viewer_id [String, nil] Use with reviewed boolean to filter by observations reviewed by the provided viewer_id
@param locale [String, nil] Locale preference for taxon common names (e.g., en-US)
@param preferred_place_id [Integer, nil] Place of preference for regional taxon common names
@param ttl [String, Integer, nil] Set the Cache-Control HTTP header with a max-age value to cache the request on iNaturalist serers and within the client
@param only_id [Boolean, nil] Only return record IDs
238 239 240 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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/nasturtium.rb', line 238 def self.mapping(asset_type, zoom_level, x, y, return_json: false, color: nil, style: nil, tile_size: nil, q: nil, search_on: nil, id: nil, not_id: nil, acc: nil, captive: nil, endemic: nil, geo: nil, identified: nil, introduced: nil, mappable: nil, native: nil, out_of_range: nil, pcid: nil, photos: nil, popular: nil, sounds: nil, taxon_is_active: nil, threatened: nil, verifiable: nil, licensed: nil, photo_licensed: nil, photo_license: nil, sound_license: nil, ofv_datatype: nil, place_id: nil, project_id: nil, rank: nil, site_id: nil, taxon_id: nil, without_taxon_id: nil, taxon_name: nil, user_id: nil, user_login: nil, ident_user_id: nil, day: nil, month: nil, year: nil, term_id: nil, without_term_id: nil, term_value_id: nil, without_term_value_id: nil, acc_below: nil, acc_below_or_unknown: nil, acc_above: nil, before: nil, observed_on: nil, after: nil, created_before: nil, created_on: nil, created_after: nil, unobserved_by_user_id: nil, apply_project_rules_for: nil, conservation_status: nil, conservation_status_authority: nil, conservation_status_iucn: nil, geoprivacy: nil, taxon_geoprivacy: nil, rank_lowest: nil, rank_highest: nil, iconic_taxa: nil, id_below: nil, id_above: nil, identifications: nil, latitude: nil, longitude: nil, radius: nil, ne_latitude: nil, ne_longitude: nil, sw_latitude: nil, sw_longitude: nil, list_id: nil, not_in_project: nil, not_matching_project_rules_for: nil, quality_grade: nil, updated_since: nil, viewer_id: nil, reviewed: nil, locale: nil, preferred_place_id: nil, only_id: nil, ttl: nil, order: nil, order_by: nil, page: nil, per_page: nil, headers: false, verbose: false) if !color.nil? and color.include? '#' color = color.gsub('#', '%23') end endpoint = '' if ['colored_heatmap', 'grid', 'heatmap', 'points'].include? asset_type if return_json endpoint = "#{asset_type}/#{zoom_level}/#{x}/#{y}.grid.json" else endpoint = "#{asset_type}/#{zoom_level}/#{x}/#{y}.png" end elsif asset_type == 'places' endpoint = "places/#{place_id}/#{zoom_level}/#{x}/#{y}.png" if place_id.nil? raise "place_id must be provided" end elsif asset_type == 'taxon_places' endpoint = "taxon_places/#{taxon_id}/#{zoom_level}/#{x}/#{y}.png" if taxon_id.nil? raise "taxon_id must be provided" end elsif asset_type == 'taxon_ranges' endpoint = "taxon_ranges/#{taxon_id}/#{zoom_level}/#{x}/#{y}.png" if taxon_id.nil? raise "taxon_id must be provided" end else raise "Invalid asset_type: #{asset_type} (must be one of: colored_heatmap, grid, heatmap, points, places, taxon_places, taxon_ranges)" end Request.new(endpoint: endpoint, color: color, style: style, tile_size: tile_size, q: q, search_on: search_on, id: id, not_id: not_id, acc: acc, captive: captive, endemic: endemic, geo: geo, identified: identified, introduced: introduced, mappable: mappable, native: native, out_of_range: out_of_range, pcid: pcid, photos: photos, popular: popular, sounds: sounds, taxon_is_active: taxon_is_active, threatened: threatened, verifiable: verifiable, licensed: licensed, photo_licensed: photo_licensed, photo_license: photo_license, sound_license: sound_license, ofv_datatype: ofv_datatype, place_id: place_id, project_id: project_id, rank: rank, site_id: site_id, taxon_id: taxon_id, without_taxon_id: without_taxon_id, taxon_name: taxon_name, user_id: user_id, user_login: user_login, ident_user_id: ident_user_id, day: day, month: month, year: year, term_id: term_id, without_term_id: without_term_id, term_value_id: term_value_id, without_term_value_id: without_term_value_id, acc_below: acc_below, acc_below_or_unknown: acc_below_or_unknown, acc_above: acc_above, before: before, observed_on: observed_on, after: after, created_before: created_before, created_on: created_on, created_after: created_after, unobserved_by_user_id: unobserved_by_user_id, apply_project_rules_for: apply_project_rules_for, conservation_status: conservation_status, conservation_status_authority: , conservation_status_iucn: conservation_status_iucn, geoprivacy: geoprivacy, taxon_geoprivacy: taxon_geoprivacy, rank_lowest: rank_lowest, rank_highest: rank_highest, iconic_taxa: iconic_taxa, id_below: id_below, id_above: id_above, identifications: identifications, latitude: latitude, longitude: longitude, radius: radius, ne_latitude: ne_latitude, ne_longitude: ne_longitude, sw_latitude: sw_latitude, sw_longitude: sw_longitude, list_id: list_id, not_in_project: not_in_project, not_matching_project_rules_for: not_matching_project_rules_for, quality_grade: quality_grade, updated_since: updated_since, viewer_id: viewer_id, reviewed: reviewed, locale: locale, preferred_place_id: preferred_place_id, only_id: only_id, ttl: ttl, order: order, order_by: order_by, page: page, per_page: per_page, headers: headers, verbose: verbose).perform end |
.observations(subresource: nil, q: nil, search_on: nil, id: nil, not_id: nil, acc: nil, captive: nil, endemic: nil, geo: nil, identified: nil, introduced: nil, mappable: nil, native: nil, out_of_range: nil, pcid: nil, photos: nil, popular: nil, sounds: nil, taxon_is_active: nil, threatened: nil, verifiable: nil, licensed: nil, photo_licensed: nil, photo_license: nil, sound_license: nil, ofv_datatype: nil, place_id: nil, project_id: nil, rank: nil, site_id: nil, taxon_id: nil, without_taxon_id: nil, taxon_name: nil, user_id: nil, user_login: nil, ident_user_id: nil, day: nil, month: nil, year: nil, term_id: nil, without_term_id: nil, term_value_id: nil, without_term_value_id: nil, acc_below: nil, acc_below_or_unknown: nil, acc_above: nil, before: nil, observed_on: nil, after: nil, created_before: nil, created_on: nil, created_after: nil, unobserved_by_user_id: nil, apply_project_rules_for: nil, conservation_status: nil, conservation_status_authority: nil, conservation_status_iucn: nil, geoprivacy: nil, taxon_geoprivacy: nil, rank_lowest: nil, rank_highest: nil, iconic_taxa: nil, id_below: nil, id_above: nil, identifications: nil, latitude: nil, longitude: nil, radius: nil, ne_latitude: nil, ne_longitude: nil, sw_latitude: nil, sw_longitude: nil, list_id: nil, not_in_project: nil, not_matching_project_rules_for: nil, quality_grade: nil, updated_since: nil, viewer_id: nil, reviewed: nil, locale: nil, preferred_place_id: nil, only_id: nil, ttl: nil, order: nil, order_by: nil, page: nil, per_page: nil, headers: false, verbose: false) ⇒ Hash, Boolean
Get observations
Note: use the subresource parameter to access these subresource endpoints which share the same parameters as /observations:
/observations/histogram
/observations/identifiers
/observations/observers
/observations/popular_field_values
/observations/species_counts
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 |
# File 'lib/nasturtium.rb', line 671 def self.observations(subresource: nil, q: nil, search_on: nil, id: nil, not_id: nil, acc: nil, captive: nil, endemic: nil, geo: nil, identified: nil, introduced: nil, mappable: nil, native: nil, out_of_range: nil, pcid: nil, photos: nil, popular: nil, sounds: nil, taxon_is_active: nil, threatened: nil, verifiable: nil, licensed: nil, photo_licensed: nil, photo_license: nil, sound_license: nil, ofv_datatype: nil, place_id: nil, project_id: nil, rank: nil, site_id: nil, taxon_id: nil, without_taxon_id: nil, taxon_name: nil, user_id: nil, user_login: nil, ident_user_id: nil, day: nil, month: nil, year: nil, term_id: nil, without_term_id: nil, term_value_id: nil, without_term_value_id: nil, acc_below: nil, acc_below_or_unknown: nil, acc_above: nil, before: nil, observed_on: nil, after: nil, created_before: nil, created_on: nil, created_after: nil, unobserved_by_user_id: nil, apply_project_rules_for: nil, conservation_status: nil, conservation_status_authority: nil, conservation_status_iucn: nil, geoprivacy: nil, taxon_geoprivacy: nil, rank_lowest: nil, rank_highest: nil, iconic_taxa: nil, id_below: nil, id_above: nil, identifications: nil, latitude: nil, longitude: nil, radius: nil, ne_latitude: nil, ne_longitude: nil, sw_latitude: nil, sw_longitude: nil, list_id: nil, not_in_project: nil, not_matching_project_rules_for: nil, quality_grade: nil, updated_since: nil, viewer_id: nil, reviewed: nil, locale: nil, preferred_place_id: nil, only_id: nil, ttl: nil, order: nil, order_by: nil, page: nil, per_page: nil, headers: false, verbose: false) endpoint = 'observations' endpoint = "#{endpoint}/#{subresource}" unless subresource.nil? Request.new(endpoint: endpoint, q: q, search_on: search_on, id: id, not_id: not_id, acc: acc, captive: captive, endemic: endemic, geo: geo, identified: identified, introduced: introduced, mappable: mappable, native: native, out_of_range: out_of_range, pcid: pcid, photos: photos, popular: popular, sounds: sounds, taxon_is_active: taxon_is_active, threatened: threatened, verifiable: verifiable, licensed: licensed, photo_licensed: photo_licensed, photo_license: photo_license, sound_license: sound_license, ofv_datatype: ofv_datatype, place_id: place_id, project_id: project_id, rank: rank, site_id: site_id, taxon_id: taxon_id, without_taxon_id: without_taxon_id, taxon_name: taxon_name, user_id: user_id, user_login: user_login, ident_user_id: ident_user_id, day: day, month: month, year: year, term_id: term_id, without_term_id: without_term_id, term_value_id: term_value_id, without_term_value_id: without_term_value_id, acc_below: acc_below, acc_below_or_unknown: acc_below_or_unknown, acc_above: acc_above, before: before, observed_on: observed_on, after: after, created_before: created_before, created_on: created_on, created_after: created_after, unobserved_by_user_id: unobserved_by_user_id, apply_project_rules_for: apply_project_rules_for, conservation_status: conservation_status, conservation_status_authority: , conservation_status_iucn: conservation_status_iucn, geoprivacy: geoprivacy, taxon_geoprivacy: taxon_geoprivacy, rank_lowest: rank_lowest, rank_highest: rank_highest, iconic_taxa: iconic_taxa, id_below: id_below, id_above: id_above, identifications: identifications, latitude: latitude, longitude: longitude, radius: radius, ne_latitude: ne_latitude, ne_longitude: ne_longitude, sw_latitude: sw_latitude, sw_longitude: sw_longitude, list_id: list_id, not_in_project: not_in_project, not_matching_project_rules_for: not_matching_project_rules_for, quality_grade: quality_grade, updated_since: updated_since, viewer_id: viewer_id, reviewed: reviewed, locale: locale, preferred_place_id: preferred_place_id, only_id: only_id, ttl: ttl, order: order, order_by: order_by, page: page, per_page: per_page, headers: headers, verbose: verbose).perform end |
.places_autocomplete(q, order_by: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Suggest places
402 403 404 405 |
# File 'lib/nasturtium.rb', line 402 def self.places_autocomplete(q, order_by: nil, per_page: nil, verbose: false) endpoint = "places/autocomplete" Request.new(endpoint: endpoint, q: q, order_by: order_by, per_page: per_page, verbose: verbose).perform end |
.places_id(id, admin_level: nil, verbose: false) ⇒ Hash, Boolean
Get places
389 390 391 392 |
# File 'lib/nasturtium.rb', line 389 def self.places_id(id, admin_level: nil, verbose: false) endpoint = "places/#{id}" Request.new(endpoint: endpoint, admin_level: admin_level, verbose: verbose).perform end |
.places_nearby(ne_latitude, ne_longitude, sw_latitude, sw_longitude, name: nil, verbose: false) ⇒ Hash, Boolean
419 420 421 422 |
# File 'lib/nasturtium.rb', line 419 def self.places_nearby(ne_latitude, ne_longitude, sw_latitude, sw_longitude, name: nil, verbose: false) endpoint = "places/nearby" Request.new(endpoint: endpoint, ne_latitude: ne_latitude, ne_longitude: ne_longitude, sw_latitude: sw_latitude, sw_longitude: sw_longitude, name: name, verbose: verbose).perform end |
.posts(login: nil, project_id: nil, parent_id: nil, page: nil, per_page: nil, verbose: false) ⇒ Array, Boolean
Get journal posts
435 436 437 438 |
# File 'lib/nasturtium.rb', line 435 def self.posts(login: nil, project_id: nil, parent_id: nil, page: nil, per_page: nil, verbose: false) endpoint = "posts" Request.new(endpoint: endpoint, login: login, project_id: project_id, parent_id: parent_id, page: page, per_page: per_page, verbose: verbose).perform end |
.project_members(id, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get project members
482 483 484 485 |
# File 'lib/nasturtium.rb', line 482 def self.project_members(id, page: nil, per_page: nil, verbose: false) endpoint = "projects/#{id}/members" Request.new(endpoint: endpoint, page: page, per_page: per_page, verbose: verbose).perform end |
.projects(q: nil, autocomplete: nil, id: nil, not_id: nil, latitude: nil, longitude: nil, radius: nil, place_id: nil, featured: nil, noteworthy: nil, site_id: nil, rule_details: nil, type: nil, member_id: nil, has_params: nil, has_posts: nil, page: nil, per_page: nil, order_by: nil, verbose: false) ⇒ Hash, Boolean
TODO: Add tests Get projects
465 466 467 468 469 470 471 472 |
# File 'lib/nasturtium.rb', line 465 def self.projects(q: nil, autocomplete: nil, id: nil, not_id: nil, latitude: nil, longitude: nil, radius: nil, place_id: nil, featured: nil, noteworthy: nil, site_id: nil, rule_details: nil, type: nil, member_id: nil, has_params: nil, has_posts: nil, page: nil, per_page: nil, order_by: nil, verbose: false) if autocomplete endpoint = "projects/autocomplete" else endpoint = "projects" end Request.new(endpoint: endpoint, q: q, id: id, not_id: not_id, latitude: latitude, longitude: longitude, radius: radius, place_id: place_id, featured: featured, noteworthy: noteworthy, site_id: site_id, rule_details: rule_details, type: type, member_id: member_id, has_params: has_params, has_posts: has_posts, page: page, per_page: per_page, order_by: order_by, verbose: verbose).perform end |
.search(q: nil, sources: nil, place_id: nil, preferred_place_id: nil, locale: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Search places, projects, taxa, users
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/nasturtium.rb', line 499 def self.search(q: nil, sources: nil, place_id: nil, preferred_place_id: nil, locale: nil, page: nil, per_page: nil, verbose: false) endpoint = 'search' Request.new( endpoint: endpoint, q: q, sources: sources, place_id: place_id, preferred_place_id: preferred_place_id, locale: locale, page: page, per_page: per_page, verbose: verbose ).perform end |
.taxa(id: nil, q: nil, is_active: nil, taxon_id: nil, parent_id: nil, rank: nil, rank_level: nil, id_above: nil, id_below: nil, locale: nil, only_id: nil, all_names: nil, preferred_place_id: nil, order: nil, order_by: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Taxon search
806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'lib/nasturtium.rb', line 806 def self.taxa(id: nil, q: nil, is_active: nil, taxon_id: nil, parent_id: nil, rank: nil, rank_level: nil, id_above: nil, id_below: nil, locale: nil, only_id: nil, all_names: nil, preferred_place_id: nil, order: nil, order_by: nil, page: nil, per_page: nil, verbose: false) if id.nil? endpoint = 'taxa' Request.new(endpoint: endpoint, q: q, is_active: is_active, taxon_id: taxon_id, parent_id: parent_id, rank: rank, rank_level: rank_level, id_above: id_above, id_below: id_below, locale: locale, only_id: only_id, all_names: all_names, preferred_place_id: preferred_place_id, order: order, order_by: order_by, page: page, per_page: per_page, verbose: verbose).perform else endpoint = "taxa/#{id}" Request.new(endpoint: endpoint, verbose: verbose).perform end end |
.taxa_autocomplete(q: nil, is_active: nil, taxon_id: nil, rank: nil, rank_level: nil, locale: nil, preferred_place_id: nil, all_names: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Taxon suggest
835 836 837 838 839 840 841 |
# File 'lib/nasturtium.rb', line 835 def self.taxa_autocomplete(q: nil, is_active: nil, taxon_id: nil, rank: nil, rank_level: nil, locale: nil, preferred_place_id: nil, all_names: nil, per_page: nil, verbose: false) endpoint = 'taxa/autocomplete' Request.new(endpoint: endpoint, q: q, is_active: is_active, taxon_id: taxon_id, rank: rank, rank_level: rank_level, locale: locale, preferred_place_id: preferred_place_id, all_names: all_names, per_page: per_page, verbose: verbose).perform end |
.user(id, verbose: false) ⇒ Hash, Boolean
Get user
521 522 523 524 |
# File 'lib/nasturtium.rb', line 521 def self.user(id, verbose: false) endpoint = "users/#{id}" Request.new(endpoint: endpoint, verbose: verbose).perform end |
.user_autocomplete(q, project_id: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get user suggestions
561 562 563 564 |
# File 'lib/nasturtium.rb', line 561 def self.user_autocomplete(q, project_id: nil, per_page: nil, verbose: false) endpoint = "users/autocomplete" Request.new(endpoint: endpoint, q: q, project_id: project_id, per_page: per_page, verbose: verbose).perform end |
.user_me(verbose: false) ⇒ Hash, Boolean
Get logged in user
532 533 534 535 |
# File 'lib/nasturtium.rb', line 532 def self.user_me(verbose: false) endpoint = "users/me" Request.new(endpoint: endpoint, verbose: verbose).perform end |
.user_projects(id, rule_details: nil, project_type: nil, page: nil, per_page: nil, verbose: false) ⇒ Hash, Boolean
Get user’s projects
547 548 549 550 551 |
# File 'lib/nasturtium.rb', line 547 def self.user_projects(id, rule_details: nil, project_type: nil, page: nil, per_page: nil, verbose: false) endpoint = "users/#{id}/projects" Request.new(endpoint: endpoint, rule_details: rule_details, project_type: project_type, page: page, per_page: per_page, verbose: verbose).perform end |