Class: Ecoportal::API::V1::PersonSchemas
- Inherits:
-
Object
- Object
- Ecoportal::API::V1::PersonSchemas
- Extended by:
- Common::BaseClass
- Includes:
- Enumerable
- Defined in:
- lib/ecoportal/api/v1/person_schemas.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Common::Client
readonly
a
Common::Clientobject that holds the configuration of the api connection.
Instance Method Summary collapse
-
#each(params: {}) {|schema| ... } ⇒ Enumerable<PersonSchema>
If a
blockis not given it calls Object#to_enum Otherwise it callsget_all. -
#get_all ⇒ Enumerable<PersonSchema>
Gets all the schemas via api request.
-
#initialize(client) ⇒ Schemas
constructor
An instance object ready to make schema api requests.
Methods included from Common::BaseClass
class_resolver, redef_without_warning, resolve_class
Constructor Details
#initialize(client) ⇒ Schemas
Returns an instance object ready to make schema api requests.
16 17 18 |
# File 'lib/ecoportal/api/v1/person_schemas.rb', line 16 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Common::Client (readonly)
a Common::Client object that holds
the configuration of the api connection.
6 7 8 |
# File 'lib/ecoportal/api/v1/person_schemas.rb', line 6 def client @client end |
Instance Method Details
#each(params: {}) {|schema| ... } ⇒ Enumerable<PersonSchema>
Note:
:paramsdoesn't really do anything.- same as #get_all but with block :)
to_awill calleach(see this detailed explanation)- however, as far as you have an iterator, such as
each,to_ashould be last resource (see this explanation)
- however, as far as you have an iterator, such as
If a block is not given it calls Object#to_enum
Otherwise it calls get_all.
39 40 41 42 43 |
# File 'lib/ecoportal/api/v1/person_schemas.rb', line 39 def each(params: {}, &block) return to_enum(:each, params: params) unless block get_all.each(&block) end |
#get_all ⇒ Enumerable<PersonSchema>
Gets all the schemas via api request.
22 23 24 25 |
# File 'lib/ecoportal/api/v1/person_schemas.rb', line 22 def get_all # rubocop:disable Naming/AccessorMethodName response = client.get('/person_schemas') Common::WrappedResponse.new(response, person_schema_class) end |