lhs 5.7.0 → 5.7.1

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: d254b18e7c8820a918573b52e0e63156c752d174
4
- data.tar.gz: 0fc88aedee1ad5ed13c45fcc6d728159f6181594
3
+ metadata.gz: b8fe4ac73d6355f5299f3f30b469f2e13fb15bfe
4
+ data.tar.gz: fefa077f115710e969b0f09d5e82c0b9bde6e0dd
5
5
  SHA512:
6
- metadata.gz: 482482df0da72c5e52525848d9fc0f7a820e7e0a27973b0d5eaa0d2423aa8a2052eed27fbff857c38b89741316e96604abd3f76f8069c37e7ab519f79d5483eb
7
- data.tar.gz: 8b3171364a64e320bcc05e9ed0cb2f34e1e7dfebb8f31f6de4daf7d765c66018b0b92f1b6b228265dbb7baf928ded6f9124d95c0fb1f36030f503fb15d46707a
6
+ metadata.gz: 344f8f4704e193a8185f4f78a341afb80d160a59e52ae33845f8c9d8ee09f929aa2f3aa4401cd704a20e589316c7d425f8ad719e4d8b915849b3a28c654835c1
7
+ data.tar.gz: 79ea9e5130c14c4a0403ba11848f799d7f0d7015a4fea2b2a83c565981c223c686d16b617faa181f50cd26454a2aac2429b1b2a14e6127d5b8462eaf302e4d44
@@ -0,0 +1,12 @@
1
+ require 'active_support'
2
+
3
+ class LHS::Data
4
+
5
+ module ToHash
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ delegate :to_h, :to_hash, to: :_raw
10
+ end
11
+ end
12
+ end
@@ -5,6 +5,7 @@ Dir[File.dirname(__FILE__) + '/concerns/data/*.rb'].each { |file| require file }
5
5
  class LHS::Data
6
6
  include Equality
7
7
  include Json
8
+ include ToHash
8
9
 
9
10
  delegate :instance_methods, :items_key, :limit_key, :total_key, :pagination_key, to: :class
10
11
 
@@ -1,3 +1,3 @@
1
1
  module LHS
2
- VERSION = "5.7.0"
2
+ VERSION = "5.7.1"
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'rails_helper'
2
+
3
+ describe LHS::Record do
4
+ before(:each) do
5
+ class Record < LHS::Record
6
+ endpoint 'http://datastore/records'
7
+ end
8
+ end
9
+
10
+ let(:item) { { name: 'Thomas' } }
11
+ let(:body) { [item] }
12
+
13
+ it 'converts itself to hash' do
14
+ stub_request(:get, "http://datastore/records")
15
+ .to_return(body: body.to_json)
16
+ record = Record.where.first
17
+ expect(record.to_h).to eq item
18
+ expect(record.to_hash).to eq item
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhs
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.0
4
+ version: 5.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhs/graphs/contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lhc
@@ -179,6 +179,7 @@ files:
179
179
  - lib/lhs/concerns/collection/internal_collection.rb
180
180
  - lib/lhs/concerns/data/equality.rb
181
181
  - lib/lhs/concerns/data/json.rb
182
+ - lib/lhs/concerns/data/to_hash.rb
182
183
  - lib/lhs/concerns/item/destroy.rb
183
184
  - lib/lhs/concerns/item/save.rb
184
185
  - lib/lhs/concerns/item/update.rb
@@ -312,6 +313,7 @@ files:
312
313
  - spec/record/save_spec.rb
313
314
  - spec/record/scope_chains_spec.rb
314
315
  - spec/record/select_spec.rb
316
+ - spec/record/to_hash_spec.rb
315
317
  - spec/record/to_json_spec.rb
316
318
  - spec/record/where_chains_spec.rb
317
319
  - spec/record/where_spec.rb
@@ -453,6 +455,7 @@ test_files:
453
455
  - spec/record/save_spec.rb
454
456
  - spec/record/scope_chains_spec.rb
455
457
  - spec/record/select_spec.rb
458
+ - spec/record/to_hash_spec.rb
456
459
  - spec/record/to_json_spec.rb
457
460
  - spec/record/where_chains_spec.rb
458
461
  - spec/record/where_spec.rb