Class: Phoebe::Resources::Product::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/phoebe/resources/product/stats.rb

Overview

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.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Stats

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

Parameters:



57
58
59
# File 'lib/phoebe/resources/product/stats.rb', line 57

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(d, region_code:, y_:, m:, request_options: {}) ⇒ Phoebe::Models::Product::StatRetrieveResponse

Get a summary of the number of checklist submitted, species seen and contributors on a given date for a country or region.

#### Notes The results are updated every 15 minutes.

Parameters:

  • d (Integer)

    The day in the month.

  • region_code (String)

    The country, subnational1, subnational2 or location code.

  • y_ (Integer)

    The year, from 1800 to the present.

  • m (Integer)

    The month, from 1-12.

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

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/phoebe/resources/product/stats.rb', line 32

def retrieve(d, params)
  parsed, options = Phoebe::Product::StatRetrieveParams.dump_request(params)
  region_code =
    parsed.delete(:region_code) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  y_ =
    parsed.delete(:y_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  m =
    parsed.delete(:m) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["product/stats/%1$s/%2$s/%3$s/%4$s", region_code, y_, m, d],
    model: Phoebe::Models::Product::StatRetrieveResponse,
    options: options
  )
end