Class: Phoebe::Resources::Data::Observations::Recent::Notable

Inherits:
Object
  • Object
show all
Defined in:
lib/phoebe/resources/data/observations/recent/notable.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:) ⇒ Notable

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 Notable.

Parameters:



55
56
57
# File 'lib/phoebe/resources/data/observations/recent/notable.rb', line 55

def initialize(client:)
  @client = client
end

Instance Method Details

#list(region_code, back: nil, detail: nil, hotspot: nil, max_results: nil, r: nil, spp_locale: nil, request_options: {}) ⇒ Array<Phoebe::Models::Data::Observation>

Get the list of recent, notable observations (up to 30 days ago) of birds seen in a country, region or location. Notable observations can be for locally or nationally rare species or are otherwise unusual, e.g. over-wintering birds in a species which is normally only a summer visitor.

Parameters:

  • region_code (String)

    The country, subnational1, subnational2 or location code.

  • back (Integer)

    The number of days back to fetch observations.

  • detail (Symbol, Phoebe::Models::Data::Observations::Recent::NotableListParams::Detail)

    Include a subset (simple), or all (full), of the fields available.

  • hotspot (Boolean)

    Only fetch observations from hotspots

  • max_results (Integer)

    Only fetch this number of observations

  • r (Array<String>)

    Fetch observations from up to 10 locations

  • spp_locale (String)

    Use this language for species common names

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

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/phoebe/resources/data/observations/recent/notable.rb', line 40

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