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

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

Defined Under Namespace

Classes: Notable, Species

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Recent

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

Parameters:



81
82
83
84
85
# File 'lib/phoebe/resources/data/observations/geo/recent.rb', line 81

def initialize(client:)
  @client = client
  @species = Phoebe::Resources::Data::Observations::Geo::Recent::Species.new(client: client)
  @notable = Phoebe::Resources::Data::Observations::Geo::Recent::Notable.new(client: client)
end

Instance Attribute Details

#notablePhoebe::Resources::Data::Observations::Geo::Recent::Notable (readonly)

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.



28
29
30
# File 'lib/phoebe/resources/data/observations/geo/recent.rb', line 28

def notable
  @notable
end

#speciesPhoebe::Resources::Data::Observations::Geo::Recent::Species (readonly)

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.



20
21
22
# File 'lib/phoebe/resources/data/observations/geo/recent.rb', line 20

def species
  @species
end

Instance Method Details

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

Get the list of recent observations (up to 30 days ago) of birds seen at locations within a radius of up to 50 kilometers, from a given set of coordinates. Results include only the most recent observation for each species in the region specified.

Parameters:

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

    The number of days back to fetch observations.

  • cat (Symbol, Phoebe::Models::Data::Observations::Geo::RecentListParams::Cat)

    Only fetch observations from these taxonomic categories

  • 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

  • sort (Symbol, Phoebe::Models::Data::Observations::Geo::RecentListParams::Sort)

    Sort observations by taxonomy or by date, most recent first.

  • spp_locale (String)

    Use this language for species common names

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

Returns:

See Also:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/phoebe/resources/data/observations/geo/recent.rb', line 62

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