inat-get 0.8.0.14 → 0.8.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/inat/app/globals.rb +8 -0
- data/lib/inat/app/info.rb +1 -4
- data/lib/inat/app/logging.rb +5 -0
- data/lib/inat/data/entity/flag.rb +2 -0
- data/lib/inat/data/entity/project.rb +14 -15
- data/lib/inat/data/entity/user.rb +11 -12
- data/lib/inat/data/entity.rb +8 -1
- data/lib/inat/data/query.rb +2 -0
- data/lib/inat/report/report_dsl.rb +1 -0
- data/lib/inat/report/table.rb +5 -0
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f300ef3ec85bd4a168f2d4cbda6cc8ed922bb080c3e7de57685e6d753e58ae
|
4
|
+
data.tar.gz: 9e7cb3ddacd711e9d7b79c273e2f0811f698bb3596ed7421893335d2c525252e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 190b1940be2c402d2b5ec8092618276f362b9d8eab8a732aa1dd439bc396240189fbb587dd3d7398fc67183c8d4d2c070ef791137bce967c264176ec0c914c3f
|
7
|
+
data.tar.gz: 8356abb7580c8c43d8dd603eaa6a7e2e7a4b9d0bb72320104cdf699f170cbb7d1fb0938e1a7db350cb5515c9e74dba6237ddfa059f1fd705a1eb411f73dd6c2c
|
data/lib/inat/app/globals.rb
CHANGED
data/lib/inat/app/info.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module INat
|
4
|
-
|
5
4
|
module App
|
6
|
-
|
7
5
|
module Info
|
8
|
-
|
9
6
|
AUTHOR = "Ivan Shikhalev"
|
10
7
|
EMAIL = "shkikhalev@gmail.com"
|
11
8
|
|
12
|
-
VERSION = "0.8.0.
|
9
|
+
VERSION = "0.8.0.16"
|
13
10
|
HOMEPAGE = "https://github.com/shikhalev/inat-get"
|
14
11
|
SOURCE_URL = "https://github.com/shikhalev/inat-get"
|
15
12
|
|
data/lib/inat/app/logging.rb
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
3
|
+
require_relative "../types/std"
|
4
|
+
require_relative "../types/extras"
|
5
|
+
require_relative "../types/location"
|
6
|
+
require_relative "../entity"
|
7
|
+
require_relative "../enums/projecttype"
|
8
8
|
|
9
9
|
module INat::Entity
|
10
|
-
autoload :Observation,
|
11
|
-
autoload :User,
|
12
|
-
autoload :Place,
|
13
|
-
autoload :ProjectAdmin,
|
14
|
-
autoload :ProjectObservationRule,
|
15
|
-
autoload :Flag,
|
16
|
-
autoload :Taxon,
|
10
|
+
autoload :Observation, "inat/data/entity/observation"
|
11
|
+
autoload :User, "inat/data/entity/user"
|
12
|
+
autoload :Place, "inat/data/entity/place"
|
13
|
+
autoload :ProjectAdmin, "inat/data/entity/projectadmin"
|
14
|
+
autoload :ProjectObservationRule, "inat/data/entity/projectobservationrule"
|
15
|
+
autoload :Flag, "inat/data/entity/flag"
|
16
|
+
autoload :Taxon, "inat/data/entity/taxon"
|
17
17
|
end
|
18
18
|
|
19
19
|
class INat::Entity::Project < INat::Data::Entity
|
20
|
-
|
21
20
|
include INat::Data::Types
|
22
21
|
include INat::Entity
|
23
22
|
|
@@ -90,11 +89,11 @@ class INat::Entity::Project < INat::Data::Entity
|
|
90
89
|
ignore :terms
|
91
90
|
ignore :search_parameters
|
92
91
|
ignore :rule_preferences
|
92
|
+
ignore :is_new_style_project
|
93
93
|
|
94
94
|
# @!endgroup
|
95
95
|
|
96
96
|
def to_s
|
97
|
-
"<a href=\"https://www.inaturalist.org/projects/#{
|
97
|
+
"<a href=\"https://www.inaturalist.org/projects/#{id}\"><i class=\"fa fa-briefcase\"></i> #{title}</a>"
|
98
98
|
end
|
99
|
-
|
100
99
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require_relative "../types/std"
|
4
|
+
require_relative "../types/extras"
|
5
|
+
require_relative "../entity"
|
6
6
|
|
7
7
|
module INat::Entity
|
8
|
-
autoload :Observation,
|
8
|
+
autoload :Observation, "inat/data/entity/observation"
|
9
9
|
end
|
10
10
|
|
11
11
|
class INat::Entity::User < INat::Data::Entity
|
12
|
-
|
13
12
|
include INat::Entity
|
14
13
|
|
15
14
|
api_path :users
|
@@ -39,12 +38,13 @@ class INat::Entity::User < INat::Data::Entity
|
|
39
38
|
|
40
39
|
ignore :roles # TODO: разобраться
|
41
40
|
ignore :preferences
|
41
|
+
ignore :annotated_observations_count
|
42
42
|
|
43
43
|
def sort_key
|
44
44
|
login
|
45
45
|
end
|
46
46
|
|
47
|
-
def self.by_login
|
47
|
+
def self.by_login(login)
|
48
48
|
@entities ||= {}
|
49
49
|
results = @entities.values.select { |e| e.login == login.to_s }
|
50
50
|
if results.empty?
|
@@ -52,8 +52,8 @@ class INat::Entity::User < INat::Data::Entity
|
|
52
52
|
results = from_db_rows data
|
53
53
|
end
|
54
54
|
if results.empty?
|
55
|
-
data = INat::API.query
|
56
|
-
results = data.select { |u| u[
|
55
|
+
data = INat::API.query "users/autocomplete", first_only: true, q: login
|
56
|
+
results = data.select { |u| u["login"] == login.to_s }.map { |d| parse(d) }
|
57
57
|
end
|
58
58
|
if results.empty?
|
59
59
|
nil
|
@@ -63,9 +63,8 @@ class INat::Entity::User < INat::Data::Entity
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def to_s
|
66
|
-
title =
|
67
|
-
title = " title=\"#{
|
68
|
-
"<a#{
|
66
|
+
title = ""
|
67
|
+
title = " title=\"#{name}\"" if name
|
68
|
+
"<a#{title} href=\"https://www.inaturalist.org/people/#{id}\"><i class=\"glyphicon glyphicon-user\"></i></a> @#{login}"
|
69
69
|
end
|
70
|
-
|
71
70
|
end
|
data/lib/inat/data/entity.rb
CHANGED
@@ -123,6 +123,12 @@ class INat::Data::Entity < INat::Data::Model
|
|
123
123
|
data.map { |obj| parse obj }
|
124
124
|
end
|
125
125
|
|
126
|
+
def query **params
|
127
|
+
return [] if @api_path.nil?
|
128
|
+
data = INat::API.query @api_path, **params
|
129
|
+
data.map { |obj| parse obj }
|
130
|
+
end
|
131
|
+
|
126
132
|
def load_file filename
|
127
133
|
data = API.load_file filename
|
128
134
|
data.map { |obj| parse obj }
|
@@ -143,7 +149,8 @@ class INat::Data::Entity < INat::Data::Model
|
|
143
149
|
src.each do |key, value|
|
144
150
|
key = key.intern if String === key
|
145
151
|
field = fields[key] || fields.values.find { |f| f.id_field == key }
|
146
|
-
raise ArgumentError, "Field not found in #{ self.name }: '#{ key }'!", caller unless field
|
152
|
+
# raise ArgumentError, "Field not found in #{ self.name }: '#{ key }'!", caller unless field
|
153
|
+
next unless field
|
147
154
|
if field.write?
|
148
155
|
unless (field.type === value) || (field.id_field == key && Integer === value)
|
149
156
|
if field.id_field == key
|
data/lib/inat/data/query.rb
CHANGED
@@ -67,6 +67,7 @@ module INat::Report::DSL
|
|
67
67
|
if observers
|
68
68
|
ds.observations.map { |o| "#{ o }<sup><a href=\"\##{ @@prefix }-user-#{ o.user.id }\">#{ user_rows.index { |row| row[:user] == o.user } + 1 }</a></sup>" }
|
69
69
|
else
|
70
|
+
# TODO: вынеести в константу
|
70
71
|
if ds.count > 10
|
71
72
|
[ 'Более 10 наблюдений' ]
|
72
73
|
else
|
data/lib/inat/report/table.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inat-get
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0.
|
4
|
+
version: 0.8.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Shikhalev
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: sqlite3
|
@@ -38,7 +37,6 @@ dependencies:
|
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: 2.0.6
|
41
|
-
description:
|
42
40
|
email:
|
43
41
|
- shkikhalev@gmail.com
|
44
42
|
executables:
|
@@ -116,7 +114,6 @@ licenses:
|
|
116
114
|
metadata:
|
117
115
|
homepage_uri: https://github.com/shikhalev/inat-get
|
118
116
|
source_code_uri: https://github.com/shikhalev/inat-get
|
119
|
-
post_install_message:
|
120
117
|
rdoc_options: []
|
121
118
|
require_paths:
|
122
119
|
- lib
|
@@ -131,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
128
|
- !ruby/object:Gem::Version
|
132
129
|
version: '0'
|
133
130
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
135
|
-
signing_key:
|
131
|
+
rubygems_version: 3.6.3
|
136
132
|
specification_version: 4
|
137
133
|
summary: Client for iNaturalist API.
|
138
134
|
test_files: []
|