Class: Phoebe::Resources::Product::Lists

Inherits:
Object
  • Object
show all
Defined in:
lib/phoebe/resources/product/lists.rb,
lib/phoebe/resources/product/lists/historical.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: Historical

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Lists

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

Parameters:



48
49
50
51
# File 'lib/phoebe/resources/product/lists.rb', line 48

def initialize(client:)
  @client = client
  @historical = Phoebe::Resources::Product::Lists::Historical.new(client: client)
end

Instance Attribute Details

#historicalPhoebe::Resources::Product::Lists::Historical (readonly)

The product end-points make it easy to get the information shown in various pages on the eBird web site: 1. The Top 100 contributors on a given date. 2. The checklists submitted on a given date. 3. The most recent checklists submitted. 4. A summary of the checklists submitted on a given date. 5. The details and all the observations of a checklist.



18
19
20
# File 'lib/phoebe/resources/product/lists.rb', line 18

def historical
  @historical
end

Instance Method Details

#retrieve(region_code, max_results: nil, request_options: {}) ⇒ Array<Phoebe::Models::Product::ListRetrieveResponseItem>

Get information on the most recently submitted checklists for a region.

Parameters:

  • region_code (String)

    The country, subnational1, subnational2 or location code.

  • max_results (Integer)

    Only fetch this number of checklists.

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

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/phoebe/resources/product/lists.rb', line 33

def retrieve(region_code, params = {})
  parsed, options = Phoebe::Product::ListRetrieveParams.dump_request(params)
  query = Phoebe::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["product/lists/%1$s", region_code],
    query: query.transform_keys(max_results: "maxResults"),
    model: Phoebe::Internal::Type::ArrayOf[Phoebe::Models::Product::ListRetrieveResponseItem],
    options: options
  )
end