protobuf-activerecord 3.3.8 → 3.4.0

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
  SHA1:
3
- metadata.gz: afc9f618aa5eca0b6ebff7bd45a40e411ad56a5f
4
- data.tar.gz: 451f099ed6364203bfd4082cb831449ffb5eead8
3
+ metadata.gz: 4119b771922117eaefbe019b4a439ed26f9c686b
4
+ data.tar.gz: e817cb38880bcc0b56806e22c150b066508240ab
5
5
  SHA512:
6
- metadata.gz: c4512d4e9439a8a15f8d4a280b02ba237be7230b897d341a1bbc114c14358cef50de976aac742fb5e1bb6cd0a39e2de00e739c893831de3eb3188e440f5af0a4
7
- data.tar.gz: 4c693b016c17c187011e1825ce9153b6b7d809217e1487c76b292ff6a6f3d46798b84f66ffaae40c81fe08d12b6150983dc9a72544182a0365ac20744907ef04
6
+ metadata.gz: 5a7d25240cabfcd149529f937739c2058b3c6c870d859638dfbd3a511c73aefb3f31fb98b25338ded7eb804ad6434044cdda0766dab78ef98dba3d2458da421d
7
+ data.tar.gz: 38c51901f9bcd3759e0be7776510489a8a20c200a1a972160c88a5d873b0ba5565600d1b655520434120fa7b1d0c0b35d61fa90151877300e35575874d5a8db4
@@ -11,7 +11,7 @@ module Protobuf
11
11
 
12
12
  ActiveSupport.on_load(:protobuf_rpc_service) do
13
13
  Protobuf::Rpc.middleware.insert_after Protobuf::Rpc::Middleware::Logger, Middleware::ConnectionManagement
14
- Protobuf::Rpc.middleware.insert_after Middleware::ConnectionManagement, Middleware::QueryCache
14
+ Protobuf::Rpc.middleware.insert_after Middleware::ConnectionManagementAsync, Middleware::QueryCache
15
15
  end
16
16
  end
17
17
  end
@@ -14,22 +14,12 @@ module Protobuf
14
14
  :protobuf_message
15
15
  end
16
16
 
17
- private :_protobuf_convert_attributes_to_fields
18
17
  private :_protobuf_field_symbol_transformers
19
18
  private :_protobuf_field_transformers
20
19
  private :_protobuf_message
21
20
  end
22
21
 
23
22
  module ClassMethods
24
- # :nodoc:
25
- def _protobuf_convert_attributes_to_fields(key, value)
26
- return value unless _protobuf_date_datetime_time_or_timestamp_column?(key)
27
- return nil if value.nil?
28
- return value.to_i unless _protobuf_date_column?(key)
29
-
30
- value.to_time(:utc).to_i
31
- end
32
-
33
23
  def _protobuf_field_options
34
24
  @_protobuf_field_options ||= {}
35
25
  end
@@ -313,11 +303,6 @@ module Protobuf
313
303
  hash
314
304
  end
315
305
 
316
- # :nodoc:
317
- def _protobuf_convert_attributes_to_fields(field, value)
318
- self.class._protobuf_convert_attributes_to_fields(field, value)
319
- end
320
-
321
306
  # :nodoc:
322
307
  def _protobuf_field_symbol_transformers
323
308
  self.class._protobuf_field_symbol_transformers
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module ActiveRecord
3
- VERSION = "3.3.8"
3
+ VERSION = "3.4.0"
4
4
  end
5
5
  end
@@ -8,72 +8,6 @@ end
8
8
  describe Protobuf::ActiveRecord::Serialization do
9
9
  let(:protobuf_message) { UserMessage }
10
10
 
11
- describe "._protobuf_convert_attributes_to_fields" do
12
- context "when the column type is :date" do
13
- let(:date) { Date.new(2015, 10, 1) }
14
- let(:integer) { 1_443_657_600 }
15
-
16
- before {
17
- allow(User).to receive(:_protobuf_date_datetime_time_or_timestamp_column?).and_return(true)
18
- allow(User).to receive(:_protobuf_date_column?).and_return(true)
19
- }
20
-
21
- it "converts the given value to an integer" do
22
- expect(User._protobuf_convert_attributes_to_fields(:foo_date, date)).to eq integer
23
- end
24
- end
25
-
26
- context "when the column type is :datetime" do
27
- let(:datetime) { DateTime.current }
28
- let(:integer) { datetime.to_time.to_i }
29
-
30
- before {
31
- allow(User).to receive(:_protobuf_date_datetime_time_or_timestamp_column?).and_return(true)
32
- allow(User).to receive(:_protobuf_datetime_column?).and_return(true)
33
- }
34
-
35
- it "converts the given value to an integer" do
36
- expect(User._protobuf_convert_attributes_to_fields(:foo_datetime, datetime)).to eq integer
37
- end
38
- end
39
-
40
- context "when the column type is :time" do
41
- let(:time) { Time.current }
42
- let(:integer) { time.to_time.to_i }
43
-
44
- before {
45
- allow(User).to receive(:_protobuf_date_datetime_time_or_timestamp_column?).and_return(true)
46
- allow(User).to receive(:_protobuf_time_column?).and_return(true)
47
- }
48
-
49
- it "converts the given value to an integer" do
50
- expect(User._protobuf_convert_attributes_to_fields(:foo_time, time)).to eq integer
51
- end
52
- end
53
-
54
- context "when the column type is :timestamp" do
55
- let(:timestamp) { Time.current }
56
- let(:integer) { timestamp.to_time.to_i }
57
-
58
- before {
59
- allow(User).to receive(:_protobuf_date_datetime_time_or_timestamp_column?).and_return(true)
60
- allow(User).to receive(:_protobuf_timestamp_column?).and_return(true)
61
- }
62
-
63
- it "converts the given value to an integer" do
64
- expect(User._protobuf_convert_attributes_to_fields(:foo_timestamp, timestamp)).to eq integer
65
- end
66
- end
67
-
68
- context "when no conversion is necessary" do
69
- let(:value) { "Foo" }
70
-
71
- it "returns the given value" do
72
- expect(User._protobuf_convert_attributes_to_fields(:foo, value)).to eq value
73
- end
74
- end
75
- end
76
-
77
11
  describe ".field_from_record" do
78
12
  context "when the given converter is a symbol" do
79
13
  before { User.field_from_record :first_name, :extract_first_name }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.8
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hutchison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord