class Ecoportal::API::V1::PersonSchemas
@attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
Attributes
Public Class Methods
@param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection. @return [Schemas] an instance object ready to make schema api requests.
# File lib/ecoportal/api/v1/person_schemas.rb, line 15 def initialize(client) @client = client end
Public Instance Methods
If a `block` is not given it calls [Object#to_enum](ruby-doc.org/core-2.6.2/Object.html#method-i-to_enum) Otherwise it calls `get_all`. @note
- `:params` doesn't really do anything. - same as #get_all but with block :) - `to_a` will call `each` (see this [detailed explanation](https://stackoverflow.com/a/45201663/4352306)) - however, as far as you have an iterator, such as `each`, `to_a` should be last resource (see [this explanation](https://stackoverflow.com/a/44186921/4352306))
@yield [schema] does some stuff with the schema. @yieldparam schema [PersonSchema] @yieldreturn [PersonSchema] @return [Enumerable<PersonSchema>] an `Enumerable` with all the person schema objects.
# File lib/ecoportal/api/v1/person_schemas.rb, line 37 def each(params: {}, &block) return to_enum(:each) unless block get_all.each(&block) end
Gets all the schemas via api request. @return [Enumerable<PersonSchema>] an `Enumerable` with all schemas already wrapped as `PersonSchema` objects.
# File lib/ecoportal/api/v1/person_schemas.rb, line 21 def get_all response = client.get("/person_schemas") Common::WrappedResponse.new(response, person_schema_class) end