Class: Phoebe::Resources::Data::Observations::Recent::Historic
- Inherits:
-
Object
- Object
- Phoebe::Resources::Data::Observations::Recent::Historic
- Defined in:
- lib/phoebe/resources/data/observations/recent/historic.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
-
#initialize(client:) ⇒ Historic
constructor
private
A new instance of Historic.
-
#list(d, region_code:, y_:, m:, cat: nil, detail: nil, hotspot: nil, include_provisional: nil, max_results: nil, r: nil, rank: nil, spp_locale: nil, request_options: {}) ⇒ Array<Phoebe::Models::Data::Observation>
Get a list of all taxa seen in a country, region or location on a specific date, with the specific observations determined by the “rank” parameter (defaults to latest observation on the date).
Constructor Details
#initialize(client:) ⇒ Historic
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 Historic.
82 83 84 |
# File 'lib/phoebe/resources/data/observations/recent/historic.rb', line 82 def initialize(client:) @client = client end |
Instance Method Details
#list(d, region_code:, y_:, m:, cat: nil, detail: nil, hotspot: nil, include_provisional: nil, max_results: nil, r: nil, rank: nil, spp_locale: nil, request_options: {}) ⇒ Array<Phoebe::Models::Data::Observation>
Get a list of all taxa seen in a country, region or location on a specific date, with the specific observations determined by the “rank” parameter (defaults to latest observation on the date).
#### Notes Responses may be cached for 30 minutes
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/phoebe/resources/data/observations/recent/historic.rb', line 51 def list(d, params) parsed, = Phoebe::Data::Observations::Recent::HistoricListParams.dump_request(params) query = Phoebe::Internal::Util.encode_query_params(parsed) 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: ["data/obs/%1$s/historic/%2$s/%3$s/%4$s", region_code, y_, m, d], query: query.transform_keys( include_provisional: "includeProvisional", max_results: "maxResults", spp_locale: "sppLocale" ), model: Phoebe::Internal::Type::ArrayOf[Phoebe::Data::Observation], options: ) end |