Class: INatGet::Data::Manager Private

Inherits:
Object
  • Object
show all
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

Descendant Specificators collapse

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

Returns:



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

#endpointSymbol

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:

  • (Symbol)

Raises:

  • (NotImplementedError)


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.

Overloads:

Returns:

See Also:



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

#helperINatGet::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

#modelclass 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.

Returns:

  • (class of Sequel::Model)


84
85
86
# File 'lib/inat-get/data/managers/base.rb', line 84

def model
  @model ||= get_model
end

#parserINatGet::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

#sidSymbol?

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.

Returns:

  • (Symbol, nil)


136
# File 'lib/inat-get/data/managers/base.rb', line 136

def sid = nil

#updaterINatGet::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.

Returns:

  • (Boolean)


140
# File 'lib/inat-get/data/managers/base.rb', line 140

def uuid? = false