Class: INatGet::Data::Manager Private
- Inherits:
-
Object
- Object
- INatGet::Data::Manager
- Defined in:
- lib/inat-get/data/managers/base.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Identifications, Observations, Places, Projects, Taxa, Users
Defined Under Namespace
Classes: Identifications, Observations, Places, Projects, Taxa, Users
Common Methods collapse
-
#[](id) ⇒ Model?
private
Return valid item or
nil. -
#get(*args, **kwargs) ⇒ Enumerable<Model>, ...
private
Returns model instance, array of them or dataset.
Descendant Specificators collapse
- #endpoint ⇒ Symbol private
- #helper ⇒ INatGet::Data::Helper private
- #model ⇒ class of Sequel::Model private
- #parser ⇒ INatGet::Data::Parser private
-
#sid ⇒ Symbol?
private
Name of
Stringfield that can be used as identifier ornil. - #updater ⇒ INatGet::Data::Updater private
-
#uuid? ⇒ Boolean
private
trueif UUID supported.
Instance Method Details
#[](id) ⇒ Model?
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.
Return valid item or nil
71 72 73 74 |
# File 'lib/inat-get/data/managers/base.rb', line 71 def [] id self.updater.update! id get_local_one id, true end |
#endpoint ⇒ Symbol
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.
81 |
# File 'lib/inat-get/data/managers/base.rb', line 81 def endpoint = raise NotImplementedError, "Not implemented 'endpoint' in abstract base Manager", caller_locations |
#get(*ids) ⇒ Array<Model> #get(**query) ⇒ DSL::Dataset #get(condition) ⇒ DSL::Dataset
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 model instance, array of them or dataset.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/inat-get/data/managers/base.rb', line 28 def get *args, **kwargs if kwargs.empty? if args.size == 1 arg = args.first if arg.is_a?(INatGet::Data::DSL::Condition) INatGet::Data::DSL::Dataset::new nil, arg else self.updater.update!(arg) Array(get_local_one arg) end else condition = INatGet::Data::DSL::Condition::Query[self.model, id: args] self.updater.update!(*args) args.map { |arg| get_local_one(arg) } end else raise ArgumentError, "Too many arguments", caller_locations unless args.empty? condition = INatGet::Data::DSL::Condition::Query[self.model, **kwargs] INatGet::Data::DSL::Dataset::new nil, condition end end |
#helper ⇒ INatGet::Data::Helper
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.
109 110 111 |
# File 'lib/inat-get/data/managers/base.rb', line 109 def helper @helper ||= get_helper end |
#model ⇒ class of Sequel::Model
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.
84 85 86 |
# File 'lib/inat-get/data/managers/base.rb', line 84 def model @model ||= get_model end |
#parser ⇒ INatGet::Data::Parser
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.
122 123 124 |
# File 'lib/inat-get/data/managers/base.rb', line 122 def parser @parser ||= get_parser end |
#sid ⇒ Symbol?
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.
Name of String field that can be used as identifier or nil.
136 |
# File 'lib/inat-get/data/managers/base.rb', line 136 def sid = nil |
#updater ⇒ INatGet::Data::Updater
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.
96 97 98 |
# File 'lib/inat-get/data/managers/base.rb', line 96 def updater @updater ||= get_updater end |
#uuid? ⇒ Boolean
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.
true if UUID supported.
140 |
# File 'lib/inat-get/data/managers/base.rb', line 140 def uuid? = false |