inat-get 0.8.0.14 → 0.8.0.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1a46d82e846a5e0c461170448eb31b58c2f795d8cc5f8bd5e806dc99e6f4f7d
4
- data.tar.gz: d1eebcc7ac633eafbd131e723fa10835ebb11c1c18f2b0d98722936309198be2
3
+ metadata.gz: 84ded1d7ec6fde12b93015367e36c206932fc25428f6a5b29eacc1a1e619950c
4
+ data.tar.gz: a48ba5ff5aa245e8a0b1a95e7ce9d40c1cb82788902745fa532dda3a909937de
5
5
  SHA512:
6
- metadata.gz: a1484827dc6feb2dfa24012bfa9a3b92cd7689084619c381657cb2c8db86060672ef0a0ea0a8ab50105b006d388e1cfb44a02f0f48891c6db183ffa1fab9853a
7
- data.tar.gz: a9abd208f1d0795cdbfa5c736d1fe5c26f9b2f7da674520d4af1b81b3d304a40e108acf94ff4b7b57e5a13b274f6a1bab9f3bbbde10e873d2f57e2abc814ea9d
6
+ metadata.gz: 824425464d52d58478bba5f693e5670dd5728559c67884daef44ca15a9a6aa10361575e61ee5b22239d7a7842eb7b54430531cec29cd001420e20af50080337d
7
+ data.tar.gz: 6021713b825f56f796b857a6e8e02f5de08e4c628f0460da0916b8379beb6e09c67327f7a6f79aaff4d73be0d5a2390bd199c4cd4d1688f2fd83a720e7846152
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.14"
9
+ VERSION = "0.8.0.15"
13
10
  HOMEPAGE = "https://github.com/shikhalev/inat-get"
14
11
  SOURCE_URL = "https://github.com/shikhalev/inat-get"
15
12
 
@@ -23,4 +23,6 @@ class INat::Entity::Flag < INat::Data::Entity
23
23
  field :resolver, type: User, index: true
24
24
  field :comment, type: String
25
25
 
26
+ ignore :flaggable_id
27
+
26
28
  end
@@ -1,23 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../types/std'
4
- require_relative '../types/extras'
5
- require_relative '../types/location'
6
- require_relative '../entity'
7
- require_relative '../enums/projecttype'
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, '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'
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/#{ id }\"><i class=\"fa fa-briefcase\"></i>  #{ title }</a>"
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 '../types/std'
4
- require_relative '../types/extras'
5
- require_relative '../entity'
3
+ require_relative "../types/std"
4
+ require_relative "../types/extras"
5
+ require_relative "../entity"
6
6
 
7
7
  module INat::Entity
8
- autoload :Observation, 'inat/data/entity/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 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 'users/autocomplete', first_only: true, q: login
56
- results = data.select { |u| u['login'] == login.to_s }.map { |d| parse(d) }
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=\"#{ name }\"" if name
68
- "<a#{ title } href=\"https://www.inaturalist.org/people/#{ id }\"><i class=\"glyphicon glyphicon-user\"></i></a> @#{ login }"
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
@@ -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 }
@@ -23,6 +23,8 @@ class INat::Query
23
23
  include INat::App::Logger::DSL
24
24
  include INat::Data::Types
25
25
 
26
+ Place = INat::Entity::Place
27
+
26
28
  private def parse_accuracy value
27
29
  case value
28
30
  when true, false
@@ -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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inat-get
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.14
4
+ version: 0.8.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Shikhalev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-10 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.5.3
134
+ rubygems_version: 3.5.11
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Client for iNaturalist API.