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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1a46d82e846a5e0c461170448eb31b58c2f795d8cc5f8bd5e806dc99e6f4f7d
4
- data.tar.gz: d1eebcc7ac633eafbd131e723fa10835ebb11c1c18f2b0d98722936309198be2
3
+ metadata.gz: d8f300ef3ec85bd4a168f2d4cbda6cc8ed922bb080c3e7de57685e6d753e58ae
4
+ data.tar.gz: 9e7cb3ddacd711e9d7b79c273e2f0811f698bb3596ed7421893335d2c525252e
5
5
  SHA512:
6
- metadata.gz: a1484827dc6feb2dfa24012bfa9a3b92cd7689084619c381657cb2c8db86060672ef0a0ea0a8ab50105b006d388e1cfb44a02f0f48891c6db183ffa1fab9853a
7
- data.tar.gz: a9abd208f1d0795cdbfa5c736d1fe5c26f9b2f7da674520d4af1b81b3d304a40e108acf94ff4b7b57e5a13b274f6a1bab9f3bbbde10e873d2f57e2abc814ea9d
6
+ metadata.gz: 190b1940be2c402d2b5ec8092618276f362b9d8eab8a732aa1dd439bc396240189fbb587dd3d7398fc67183c8d4d2c070ef791137bce967c264176ec0c914c3f
7
+ data.tar.gz: 8356abb7580c8c43d8dd603eaa6a7e2e7a4b9d0bb72320104cdf699f170cbb7d1fb0938e1a7db350cb5515c9e74dba6237ddfa059f1fd705a1eb411f73dd6c2c
@@ -1,5 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'logging'
4
+ require_relative 'config'
5
+
6
+ module INat
7
+ module App
8
+ end
9
+ end
10
+
3
11
  module INat::App::Globals
4
12
 
5
13
  class << self
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.16"
13
10
  HOMEPAGE = "https://github.com/shikhalev/inat-get"
14
11
  SOURCE_URL = "https://github.com/shikhalev/inat-get"
15
12
 
@@ -2,6 +2,11 @@
2
2
 
3
3
  require 'logger'
4
4
 
5
+ module INat
6
+ module App
7
+ end
8
+ end
9
+
5
10
  class INat::App::Logger
6
11
 
7
12
  def config
@@ -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 }
@@ -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
@@ -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
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ module INat
4
+ module Report
5
+ end
6
+ end
7
+
3
8
  class INat::Report::Table
4
9
 
5
10
  attr_reader :columns
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.14
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: 2024-01-10 00:00:00.000000000 Z
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.5.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: []