Class: Phoebe::Resources::Data::Observations::Recent::Species
- Inherits:
-
Object
- Object
- Phoebe::Resources::Data::Observations::Recent::Species
- Defined in:
- lib/phoebe/resources/data/observations/recent/species.rb
Overview
The data/obs end-points are used to fetch observations submitted to eBird in checklists. There are two categories of end-point: 1. Fetch observations for a specific country, region or location. 2. Fetch observations for nearby locations - up to a distance of 50km. Each end-point supports optional query parameters which allow you to filter the list of observations returned.
Instance Method Summary collapse
-
#initialize(client:) ⇒ Species
constructor
private
A new instance of Species.
-
#retrieve(species_code, region_code:, back: nil, hotspot: nil, include_provisional: nil, max_results: nil, r: nil, spp_locale: nil, request_options: {}) ⇒ Array<Phoebe::Models::Data::Observation>
Get the recent observations, up to 30 days ago, of a particular species in a country, region or location.
Constructor Details
#initialize(client:) ⇒ Species
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Species.
72 73 74 |
# File 'lib/phoebe/resources/data/observations/recent/species.rb', line 72 def initialize(client:) @client = client end |
Instance Method Details
#retrieve(species_code, region_code:, back: nil, hotspot: nil, include_provisional: nil, max_results: nil, r: nil, spp_locale: nil, request_options: {}) ⇒ Array<Phoebe::Models::Data::Observation>
Get the recent observations, up to 30 days ago, of a particular species in a country, region or location. Results include only the most recent observation from each location in the region specified.
#### Notes
The species code is typically a 6-letter code, e.g. cangoo for Canada Goose. You can get complete set of species code from the GET eBird Taxonomy end-point.
When using the r query parameter set the regionCode URL parameter to an empty string.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/phoebe/resources/data/observations/recent/species.rb', line 49 def retrieve(species_code, params) parsed, = Phoebe::Data::Observations::Recent::SpecieRetrieveParams.dump_request(params) query = Phoebe::Internal::Util.encode_query_params(parsed) region_code = parsed.delete(:region_code) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["data/obs/%1$s/recent/%2$s", region_code, species_code], query: query.transform_keys( include_provisional: "includeProvisional", max_results: "maxResults", spp_locale: "sppLocale" ), model: Phoebe::Internal::Type::ArrayOf[Phoebe::Data::Observation], options: ) end |