ree_lib 1.0.74 → 1.0.76

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db0e9f5e3c64d69ff4f6d4d4550ab6563bfe0bc9529333e21a1251503ad562b2
4
- data.tar.gz: 02abcd3afb9f8155666b98abdb5a9f833b3affca8038c19b2322ab60be82e2db
3
+ metadata.gz: fb85650b5a10f4ec01e8323cd6caef7585821acc583a8c1727eec0a3fb4e7f5c
4
+ data.tar.gz: 2839d01f406e6c997fea3a19c3aa7d641fe4df8f1bf3ef1ccd3f5044f5f5f094
5
5
  SHA512:
6
- metadata.gz: 07f42d6c784721984a1729cd38412c946fd8924982d98eff0158a91c4ce9f5c80ef94561e0ea9801a0e1df3baa177ef6bf7ae0db5c177c1f2960f118a339d797
7
- data.tar.gz: 25c0ae598cdbfee90f4ea991705fd73328188f64f33bd2895635bff5d98dc527c2a209b40fa286208d327f0f50cd6e03e36b192b3b8ea2076166d685b9c227ac
6
+ metadata.gz: 10cf83f3f3e3429a085c15179fe25e0ac278e73d8e2c595522dc99764a787aabee1e8b14e9bd6b3522fc2969fb8f0aec173aef09d5d8dd97250e0cdf8f02e51e
7
+ data.tar.gz: a3c2644c4972910c1cbb7d8ef26bbac66f7e575f281f087026f17d9efe3ac24e3cf842473dd9d4ad32319d9761820b90fba28910d97290471ddc219cbbf44300
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.73)
4
+ ree_lib (1.0.76)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -51,7 +51,7 @@ GEM
51
51
  rack (>= 1.3)
52
52
  rainbow (3.1.1)
53
53
  rake (13.0.6)
54
- ree (1.0.31)
54
+ ree (1.0.32)
55
55
  commander (~> 4.6.0)
56
56
  rexml (3.2.5)
57
57
  roda (3.58.0)
@@ -229,7 +229,13 @@ module ReeDao
229
229
 
230
230
  def set_entity_primary_key(entity, raw, key)
231
231
  if key && !primary_key.is_a?(Array)
232
- entity.instance_variable_set("@#{primary_key}", key)
232
+ if entity.respond_to?("#{primary_key}=")
233
+ entity.send("#{primary_key}=", key)
234
+ elsif entity.respond_to?("set_#{primary_key}")
235
+ entity.send("set_#{primary_key}", key)
236
+ else
237
+ entity.instance_variable_set("@#{primary_key}", key)
238
+ end
233
239
  raw[primary_key] = key
234
240
  end
235
241
  end
@@ -2,6 +2,8 @@
2
2
  require_relative "value"
3
3
 
4
4
  class ReeEnum::BaseEnumMapper < ReeMapper::AbstractType
5
+ attr_reader :enum
6
+
5
7
  def initialize(enum)
6
8
  @enum = enum
7
9
  end
@@ -49,14 +49,12 @@ module ReeEnum
49
49
  def register_as_swagger_type
50
50
  swagger_type_registrator = ReeSwagger::RegisterType.new
51
51
 
52
- definition = swagger_definition
53
-
54
52
  [:casters, :serializers].each do |kind|
55
53
  swagger_type_registrator.call(
56
54
  kind,
57
55
  type_for_mapper.class,
58
- ->(*) {
59
- definition
56
+ ->(type, _build_schema) {
57
+ type.enum.swagger_definition
60
58
  }
61
59
  )
62
60
  end
@@ -75,6 +73,8 @@ module ReeEnum
75
73
  end
76
74
 
77
75
  def swagger_definition
76
+ return @swagger_definition if defined? @swagger_definition
77
+
78
78
  value_type = get_values.value_type
79
79
 
80
80
  type = if value_type == String
@@ -85,7 +85,7 @@ module ReeEnum
85
85
  raise NotImplementedError, "value_type #{value_type} is not supported"
86
86
  end
87
87
 
88
- {
88
+ @swagger_definition = {
89
89
  type: type,
90
90
  enum: get_values.each.map(&:value)
91
91
  }
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  package_require('ree_enum/dsl')
3
+ package_require('ree_swagger/functions/get_serializer_definition')
3
4
 
4
5
  RSpec.describe ReeEnum::DSL do
5
6
  before do
@@ -225,5 +226,12 @@ RSpec.describe ReeEnum::DSL do
225
226
  expect(TestReeEnum::Reflexives.myself).to eq(:self)
226
227
 
227
228
  expect(TestReeEnum::ContentTypes.method_defined?(:"video/mp4")).to be_falsey
229
+
230
+ swagger_definition_fetcher = ReeSwagger::GetSerializerDefinition.new
231
+ expect(
232
+ swagger_definition_fetcher.call(TestReeEnum::Reflexives.type_for_mapper, -> {})
233
+ ).not_to eq(
234
+ swagger_definition_fetcher.call(TestReeEnum::ContentTypes.type_for_mapper, -> {})
235
+ )
228
236
  }
229
237
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.74"
4
+ VERSION = "1.0.76"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.74
4
+ version: 1.0.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-30 00:00:00.000000000 Z
11
+ date: 2023-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ree
@@ -1391,7 +1391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1391
1391
  - !ruby/object:Gem::Version
1392
1392
  version: '0'
1393
1393
  requirements: []
1394
- rubygems_version: 3.3.24
1394
+ rubygems_version: 3.3.7
1395
1395
  signing_key:
1396
1396
  specification_version: 4
1397
1397
  summary: Ruby Standard Library Extensions