Class: INat::Entity::Taxon
- Inherits:
-
Data::Entity
- Object
- Data::Model
- Data::Entity
- INat::Entity::Taxon
- Includes:
- Data::Types, INat::Entity
- Defined in:
- lib/inat/data/entity/taxon.rb
Fields collapse
-
#ancestors ⇒ Array<item_type: Taxon>
The
ancestors
field. -
#children ⇒ Array<item_type: Taxon>
The
children
field. -
#created_at ⇒ type: Time
The
created_at
field. -
#default_photo ⇒ type: Photo
The
default_photo
field. -
#endemic ⇒ type: Boolean
field :ancestry, type: Ancestry field :min_species_ancestry, type: Ancestry.
-
#english_common_name ⇒ type: String
The
english_common_name
field. -
#extinct ⇒ type: Boolean
The
extinct
field. -
#iconic_taxon ⇒ type: Taxon
The
iconic_taxon
field. -
#iconic_taxon_name ⇒ type: IconicTaxa
The
iconic_taxon_name
field. -
#introduced ⇒ type: Boolean
The
introduced
field. -
#is_active ⇒ type: Boolean
The
is_active
field. -
#min_species_taxon ⇒ type: Taxon
The
min_species_taxon
field. -
#name ⇒ type: String
The
name
field. -
#native ⇒ type: Boolean
The
native
field. -
#parent ⇒ type: Taxon
The
parent
field. -
#photos_locked ⇒ type: Boolean
field :observations_count, type: Integer.
-
#preferred_common_name ⇒ type: String
field :iconic_taxon, type: Taxon, index: true.
-
#rank ⇒ type: Rank
The
rank
field. -
#rank_level ⇒ type: Float
The
rank_level
field. -
#taxon_changes_count ⇒ type: Integer
The
taxon_changes_count
field. -
#taxon_photos ⇒ Array<item_type: Photo>
The
taxon_photos
field. -
#taxon_schemes_count ⇒ type: Integer
The
taxon_schemes_count
field. -
#threatened ⇒ type: Boolean
The
threatened
field. -
#vision ⇒ type: Boolean
The
vision
field. -
#wikipedia_summary ⇒ type: String
The
wikipedia_summary
field. -
#wikipedia_url ⇒ type: URI
field :universal_search_rank, type: Integer.
Attributes inherited from Data::Entity
Instance Method Summary collapse
Methods included from Data::Types
#radius, radius, #sector, sector
Methods inherited from Data::Entity
by_id, #complete?, ddl, fetch, from_db_rows, #get, #init, #initialize, load, load_file, parse, read, #save, #to_db, #update
Methods included from App::Logger::DSL
#debug, debug, echo, #echo, error, #error, #info, info, log, #log, #warning, warning
Methods inherited from Data::Model
DDL, api_limit, api_part, api_path, backs, block, field, fields, has_path?, has_table?, #ignore, #initialize, links, #post_update, #process?, #saved?, table, #to_h, #update
Constructor Details
This class inherits a constructor from INat::Data::Entity
Instance Attribute Details
#ancestors ⇒ Array<item_type: Taxon>
Returns the ancestors
field.
58 |
# File 'lib/inat/data/entity/taxon.rb', line 58 links :ancestors, item_type: Taxon, link_field: :ancestor_id |
#children ⇒ Array<item_type: Taxon>
Returns the children
field.
61 |
# File 'lib/inat/data/entity/taxon.rb', line 61 backs :children, item_type: Taxon, ids_field: :child_ids, back_field: :parent_id, owned: false |
#created_at ⇒ type: Time
Returns the created_at
field.
43 |
# File 'lib/inat/data/entity/taxon.rb', line 43 field :created_at, type: Time |
#default_photo ⇒ type: Photo
Returns the default_photo
field.
44 |
# File 'lib/inat/data/entity/taxon.rb', line 44 field :default_photo, type: Photo |
#endemic ⇒ type: Boolean
field :ancestry, type: Ancestry field :min_species_ancestry, type: Ancestry
32 |
# File 'lib/inat/data/entity/taxon.rb', line 32 field :endemic, type: Boolean |
#english_common_name ⇒ type: String
Returns the english_common_name
field.
55 |
# File 'lib/inat/data/entity/taxon.rb', line 55 field :english_common_name, type: String |
#extinct ⇒ type: Boolean
Returns the extinct
field.
42 |
# File 'lib/inat/data/entity/taxon.rb', line 42 field :extinct, type: Boolean |
#iconic_taxon ⇒ type: Taxon
Returns the iconic_taxon
field.
33 |
# File 'lib/inat/data/entity/taxon.rb', line 33 field :iconic_taxon, type: Taxon |
#iconic_taxon_name ⇒ type: IconicTaxa
Returns the iconic_taxon_name
field.
52 |
# File 'lib/inat/data/entity/taxon.rb', line 52 field :iconic_taxon_name, type: IconicTaxa, index: true |
#introduced ⇒ type: Boolean
Returns the introduced
field.
37 |
# File 'lib/inat/data/entity/taxon.rb', line 37 field :introduced, type: Boolean |
#is_active ⇒ type: Boolean
Returns the is_active
field.
29 |
# File 'lib/inat/data/entity/taxon.rb', line 29 field :is_active, type: Boolean, index: true |
#min_species_taxon ⇒ type: Taxon
Returns the min_species_taxon
field.
34 |
# File 'lib/inat/data/entity/taxon.rb', line 34 field :min_species_taxon, type: Taxon |
#name ⇒ type: String
Returns the name
field.
40 |
# File 'lib/inat/data/entity/taxon.rb', line 40 field :name, type: String, index: true, required: true |
#native ⇒ type: Boolean
Returns the native
field.
38 |
# File 'lib/inat/data/entity/taxon.rb', line 38 field :native, type: Boolean |
#parent ⇒ type: Taxon
Returns the parent
field.
39 |
# File 'lib/inat/data/entity/taxon.rb', line 39 field :parent, type: Taxon |
#photos_locked ⇒ type: Boolean
field :observations_count, type: Integer
48 |
# File 'lib/inat/data/entity/taxon.rb', line 48 field :photos_locked, type: Boolean |
#preferred_common_name ⇒ type: String
field :iconic_taxon, type: Taxon, index: true
54 |
# File 'lib/inat/data/entity/taxon.rb', line 54 field :preferred_common_name, type: String |
#rank ⇒ type: Rank
Returns the rank
field.
41 |
# File 'lib/inat/data/entity/taxon.rb', line 41 field :rank, type: Rank, index: true |
#rank_level ⇒ type: Float
Returns the rank_level
field.
36 |
# File 'lib/inat/data/entity/taxon.rb', line 36 field :rank_level, type: Float, index: true |
#taxon_changes_count ⇒ type: Integer
Returns the taxon_changes_count
field.
45 |
# File 'lib/inat/data/entity/taxon.rb', line 45 field :taxon_changes_count, type: Integer |
#taxon_photos ⇒ Array<item_type: Photo>
Returns the taxon_photos
field.
59 |
# File 'lib/inat/data/entity/taxon.rb', line 59 links :taxon_photos, item_type: Photo, table_name: :taxon_photos |
#taxon_schemes_count ⇒ type: Integer
Returns the taxon_schemes_count
field.
46 |
# File 'lib/inat/data/entity/taxon.rb', line 46 field :taxon_schemes_count, type: Integer |
#threatened ⇒ type: Boolean
Returns the threatened
field.
35 |
# File 'lib/inat/data/entity/taxon.rb', line 35 field :threatened, type: Boolean, index: true |
#vision ⇒ type: Boolean
Returns the vision
field.
56 |
# File 'lib/inat/data/entity/taxon.rb', line 56 field :vision, type: Boolean |
#wikipedia_summary ⇒ type: String
Returns the wikipedia_summary
field.
51 |
# File 'lib/inat/data/entity/taxon.rb', line 51 field :wikipedia_summary, type: String |
#wikipedia_url ⇒ type: URI
field :universal_search_rank, type: Integer
50 |
# File 'lib/inat/data/entity/taxon.rb', line 50 field :wikipedia_url, type: URI |
Instance Method Details
#===(other) ⇒ Object
82 83 84 |
# File 'lib/inat/data/entity/taxon.rb', line 82 def === other other.id == self.id || other.ancestor_ids.include?(self.id) end |
#prepare_name(name) ⇒ Object (private)
90 91 92 |
# File 'lib/inat/data/entity/taxon.rb', line 90 private def prepare_name name name.downcase.gsub(' ', ' ').capitalize end |
#sort_key ⇒ Object
86 87 88 |
# File 'lib/inat/data/entity/taxon.rb', line 86 def sort_key [ iconic_taxon_name || IconicTaxa::UNKNOWN, name ] end |
#to_s ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/inat/data/entity/taxon.rb', line 94 def to_s if preferred_common_name "<a href=\"https://www.inaturalist.org/taxa/#{ id }\"><i class=\"icon-iconic-#{ (iconic_taxon_name || IconicTaxa::UNKNOWN).to_s.downcase }\" style=\"font-size:1.5em;height:1em;line-height:1em;\"></i> #{ prepare_name(preferred_common_name) } <i>(#{ prepare_name(name) })</i></a>" else "<a href=\"https://www.inaturalist.org/taxa/#{ id }\"><i class=\"icon-iconic-#{ (iconic_taxon_name || IconicTaxa::UNKNOWN).to_s.downcase }\" style=\"font-size:1.5em;height:1em;line-height:1em;\"></i> <i>#{ prepare_name(name) }</i></a>" end end |