Class: Phoebe::Resources::Data::Observations::Geo::Recent::Species

Inherits:
Object
  • Object
show all
Defined in:
lib/phoebe/resources/data/observations/geo/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

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.

Parameters:



75
76
77
# File 'lib/phoebe/resources/data/observations/geo/recent/species.rb', line 75

def initialize(client:)
  @client = client
end

Instance Method Details

#list(species_code, lat:, lng:, back: nil, dist: nil, hotspot: nil, include_provisional: nil, max_results: nil, spp_locale: nil, request_options: {}) ⇒ Array<Phoebe::Models::Data::Observation>

Get all observations of a species, seen up to 30 days ago, at any location within a radius of up to 50 kilometers, from a given set of coordinates. Results include only the most recent observation from each location in the region specified.

#### URL parameters

| Name | Description | | ———– | ———————– | | speciesCode | The eBird species code. |

#### Notes

The species code is typically a 6-letter code, e.g. horlar for Horned Lark. You can get complete set of species code from the GET eBird Taxonomy end-point.

Parameters:

  • species_code (String)

    The eBird species code.

  • lat (Float)
  • lng (Float)
  • back (Integer)

    The number of days back to fetch observations.

  • dist (Integer)

    The search radius from the given position, in kilometers.

  • hotspot (Boolean)

    Only fetch observations from hotspots

  • include_provisional (Boolean)

    Include observations which have not yet been reviewed.

  • max_results (Integer)

    Only fetch this number of observations

  • spp_locale (String)

    Use this language for species common names

  • request_options (Phoebe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/phoebe/resources/data/observations/geo/recent/species.rb', line 56

def list(species_code, params)
  parsed, options = Phoebe::Data::Observations::Geo::Recent::SpecieListParams.dump_request(params)
  query = Phoebe::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["data/obs/geo/recent/%1$s", species_code],
    query: query.transform_keys(
      include_provisional: "includeProvisional",
      max_results: "maxResults",
      spp_locale: "sppLocale"
    ),
    model: Phoebe::Internal::Type::ArrayOf[Phoebe::Data::Observation],
    options: options
  )
end