avo 3.19.1 → 3.19.2

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: 75b1e1b00b1a96166b6294a417cfa9f93aa7f969596ec1769caf21378ff9a352
4
- data.tar.gz: 40aef8099be597983e036ac6263722bdfaf8b9b05799721f2a75c10207df655e
3
+ metadata.gz: e9c26ac44eca3a86bccd3eeb9c147102bbd0eee8c37450e12ea5d3f154c798f9
4
+ data.tar.gz: 1309cfdc3b9d1753084862a4d690491d3da65c27d5d578cc649fe3f038315d38
5
5
  SHA512:
6
- metadata.gz: 55b00582eea6c57a9f7de0cb891bc4b6fd9fe5a698a9bb5106d8506bfaec6b13383010d2ee004dcdff6f8611304c7c38c195b219ce9610133c4fdedd63917b34
7
- data.tar.gz: 7dd45d27c32dada0389b39d06c3862269ecdf5fc3a41b31ee11a1dca5d0ee6b1d2dd69e814703de87d744677a4ffc6b457e693be70bd7c2b7abe6b3c3aa42b05
6
+ metadata.gz: d53e5a7a7a8841c13ce1991d8e4a5f7d291c37a53745d09f38f32b7dde5a336e482a0f04559089b65f52ee96a9940c0c0fc8c06a1b0065b71cdf1cb4b2046ce5
7
+ data.tar.gz: c76572642d357dab41b4db733c0f5c87ccee9c1573366d88846c1c82e1d6f3559f78dd2820a9c471fc7ac591e7dec806ab99c516e17a1ed41385c138edef43be
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (3.19.1)
4
+ avo (3.19.2)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -131,8 +131,8 @@ GEM
131
131
  money-rails (~> 1.12)
132
132
  avo-record_link_field (0.0.2)
133
133
  aws-eventstream (1.3.2)
134
- aws-partitions (1.1075.0)
135
- aws-sdk-core (3.221.0)
134
+ aws-partitions (1.1080.0)
135
+ aws-sdk-core (3.222.1)
136
136
  aws-eventstream (~> 1, >= 1.3.0)
137
137
  aws-partitions (~> 1, >= 1.992.0)
138
138
  aws-sigv4 (~> 1.9)
@@ -142,7 +142,7 @@ GEM
142
142
  aws-sdk-kms (1.99.0)
143
143
  aws-sdk-core (~> 3, >= 3.216.0)
144
144
  aws-sigv4 (~> 1.5)
145
- aws-sdk-s3 (1.182.0)
145
+ aws-sdk-s3 (1.183.0)
146
146
  aws-sdk-core (~> 3, >= 3.216.0)
147
147
  aws-sdk-kms (~> 1)
148
148
  aws-sigv4 (~> 1.5)
@@ -426,18 +426,18 @@ GEM
426
426
  net-smtp (0.5.1)
427
427
  net-protocol
428
428
  nio4r (2.7.4)
429
- nokogiri (1.18.6-aarch64-linux-gnu)
429
+ nokogiri (1.18.7-aarch64-linux-gnu)
430
430
  racc (~> 1.4)
431
- nokogiri (1.18.6-arm64-darwin)
431
+ nokogiri (1.18.7-arm64-darwin)
432
432
  racc (~> 1.4)
433
- nokogiri (1.18.6-x86_64-linux-gnu)
433
+ nokogiri (1.18.7-x86_64-linux-gnu)
434
434
  racc (~> 1.4)
435
435
  observer (0.1.2)
436
436
  orm_adapter (0.5.0)
437
437
  ostruct (0.6.1)
438
438
  pagy (9.3.4)
439
439
  parallel (1.26.3)
440
- parser (3.3.7.3)
440
+ parser (3.3.7.4)
441
441
  ast (~> 2.4.1)
442
442
  racc
443
443
  path_expander (1.1.3)
@@ -512,9 +512,9 @@ GEM
512
512
  rb-fsevent (0.11.2)
513
513
  rb-inotify (0.11.1)
514
514
  ffi (~> 1.0)
515
- rbs (3.9.1)
515
+ rbs (3.9.2)
516
516
  logger
517
- rdoc (6.13.0)
517
+ rdoc (6.13.1)
518
518
  psych (>= 4.0.0)
519
519
  redis (5.4.0)
520
520
  redis-client (>= 0.22.0)
@@ -566,7 +566,7 @@ GEM
566
566
  rubocop-ast (>= 1.38.0, < 2.0)
567
567
  ruby-progressbar (~> 1.7)
568
568
  unicode-display_width (>= 2.4.0, < 4.0)
569
- rubocop-ast (1.43.0)
569
+ rubocop-ast (1.44.0)
570
570
  parser (>= 3.3.7.2)
571
571
  prism (~> 1.4)
572
572
  rubocop-performance (1.24.0)
@@ -575,7 +575,7 @@ GEM
575
575
  rubocop-ast (>= 1.38.0, < 2.0)
576
576
  rubocop-shopify (2.16.0)
577
577
  rubocop (~> 1.62)
578
- ruby-openai (8.0.0)
578
+ ruby-openai (8.1.0)
579
579
  event_stream_parser (>= 0.3.0, < 2.0.0)
580
580
  faraday (>= 1)
581
581
  faraday-multipart (>= 1)
@@ -612,7 +612,7 @@ GEM
612
612
  simplecov-lcov (0.8.0)
613
613
  simplecov_json_formatter (0.1.4)
614
614
  smart_properties (1.17.0)
615
- solargraph (0.53.1)
615
+ solargraph (0.53.4)
616
616
  backport (~> 1.2)
617
617
  benchmark
618
618
  bundler (~> 2.0)
@@ -1,5 +1,7 @@
1
1
  module Avo
2
2
  class BaseResource < Avo::Resources::Base
3
+ abstract_resource!
4
+
3
5
  # Users can override this class to add custom methods for all resources.
4
6
  end
5
7
  end
@@ -0,0 +1,13 @@
1
+ module Avo
2
+ module Concerns
3
+ module AbstractResource
4
+ extend ActiveSupport::Concern
5
+
6
+ class_methods do
7
+ def abstract_resource! = @abstract_resource = true
8
+
9
+ def is_abstract? = @abstract_resource == true
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,8 @@
1
1
  module Avo
2
2
  module Resources
3
3
  class ArrayResource < Base
4
+ abstract_resource!
5
+
4
6
  extend ActiveSupport::DescendantsTracker
5
7
 
6
8
  include Avo::Concerns::FindAssociationField
@@ -19,6 +19,9 @@ module Avo
19
19
  include Avo::Concerns::HasDiscreetInformation
20
20
  include Avo::Concerns::RowControlsConfiguration
21
21
  include Avo::Concerns::SafeCall
22
+ include Avo::Concerns::AbstractResource
23
+
24
+ abstract_resource!
22
25
 
23
26
  # Avo::Current methods
24
27
  delegate :context, to: Avo::Current
@@ -84,6 +87,8 @@ module Avo
84
87
  class_attribute :default_sort_direction, default: :desc
85
88
  class_attribute :external_link, default: nil
86
89
 
90
+ class_attribute :abstract, default: false
91
+
87
92
  # EXTRACT:
88
93
  class_attribute :ordering
89
94
 
@@ -40,12 +40,9 @@ module Avo
40
40
  load_resources_namespace
41
41
  end
42
42
 
43
- # All descendants from Avo::Resources::Base except the internal ones
44
- Base.descendants - internal_resources
45
- end
43
+ # All descendants from Avo::Resources::Base except the internal abstract ones
46
44
 
47
- def internal_resources
48
- [Avo::BaseResource, Avo::Resources::ArrayResource]
45
+ Base.descendants.reject { _1.is_abstract? }
49
46
  end
50
47
 
51
48
  def load_resources_namespace
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.19.1" unless const_defined?(:VERSION)
2
+ VERSION = "3.19.2" unless const_defined?(:VERSION)
3
3
  end
@@ -13,6 +13,7 @@ module Generators
13
13
 
14
14
  def parent_controller
15
15
  return "Avo::ArrayController" if options["array"]
16
+ return "Avo::Core::Controllers::Http" if options["http"]
16
17
 
17
18
  options["parent-controller"] || ::Avo.configuration.resource_parent_controller
18
19
  end
@@ -22,6 +22,11 @@ module Generators
22
22
  type: :boolean,
23
23
  default: false
24
24
 
25
+ class_option "http",
26
+ desc: "Indicates if the resource should be HTTP.",
27
+ type: :boolean,
28
+ default: false
29
+
25
30
  def create
26
31
  return if override_controller?
27
32
 
@@ -33,6 +38,8 @@ module Generators
33
38
  def parent_resource
34
39
  if options["array"]
35
40
  "Avo::Resources::ArrayResource"
41
+ elsif options["http"]
42
+ "Avo::Core::Resources::Http"
36
43
  else
37
44
  "Avo::BaseResource"
38
45
  end
@@ -11,6 +11,26 @@ class Avo::Resources::<%= resource_class %> < <%= parent_resource %><% if option
11
11
  }
12
12
  ]
13
13
  end
14
+ <% elsif options["http"] %>
15
+ # self.endpoint = "https://api.openalex.org/"
16
+ # self.endpoint_key = "authors"
17
+ # self.parse_collection = -> {
18
+ # raise Avo::HttpError.new response["message"] if response["error"].present?
19
+ #
20
+ # response["results"]
21
+ # }
22
+ # self.parse_record = -> { response }
23
+ # self.parse_count = -> { response["meta"]["count"] }
24
+
25
+ ## This is required only when the ID includes characters (e.g., ".") that could be improperly routed.
26
+ # self.find_record_method = -> { query.find Base64.decode64(id) }
27
+ ## Encodes the ID for use in URL helpers. The `model_class_eval` block is executed when the model is defined in memory,
28
+ ## allowing us to override `to_param` and obfuscate the raw ID via Base64 encoding.
29
+ # self.model_class_eval = -> {
30
+ # define_method :to_param do
31
+ # Base64.encode64(id)
32
+ # end
33
+ # }
14
34
  <% else %>
15
35
  # self.includes = []
16
36
  # self.attachments = []<%= model_class_from_args %>
@@ -21,6 +41,10 @@ class Avo::Resources::<%= resource_class %> < <%= parent_resource %><% if option
21
41
  def fields
22
42
  field :id, as: :id
23
43
  field :title
44
+ end<% elsif options["http"] %>
45
+ def fields
46
+ field :id, as: :id
47
+ # field :display_name
24
48
  end<% else %>
25
49
  def fields
26
50
  field :id, as: :id<%= generate_fields %>