muve-store-mongo 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 93b785d7d848372e3e0f88d79804905bcafe8b1d
4
- data.tar.gz: 8d0ffc4195047662b2d3eaa7b4dfa8f9046f55bb
3
+ metadata.gz: a54cea969848deae36905fe9c1f2d3a5c8581638
4
+ data.tar.gz: 45071d4dbdf35c54e05daab68a05141f2b971527
5
5
  SHA512:
6
- metadata.gz: fd5c4ea2ca8c748e67a5268493d6b7c08486788591e09cab08fb9f1fbe2d798563584012c0caf239ab94b8032982ec65d850d3330a84abec9abfb6f1161ad5cd
7
- data.tar.gz: 83ba6f494982d0205f172653534ee614e46e054671a02ee12fcce99a7bd8f650f03c977e0363bfe5f99cb478077ebea5a8d898cf79e732a21b0868c574a745c3
6
+ metadata.gz: 0b13dd094274adc9c08380b39091e00a4ee7cce1eafa02a382b0283072d52ad4a3719c2ac67d7d72009c55d011da7111ce2e595ef76ba3c801a01991ad13dc79
7
+ data.tar.gz: 15740a9853c2cb63c2aabb6bd81eceac2d5af491b9ef64e1c2fe912f9dc3e0726550470af490a4fb665a95f1efb4738714f3edb29efb41590a0bf4032f300fb3
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem "bson_ext", "~> 1.10.2"
6
- gem "muve", "~> 1.2.0"
6
+ gem "muve", "~> 1.2.1"
7
7
 
8
8
  group :test do
9
9
  gem "ffaker", "~> 1.24.0"
@@ -9,10 +9,32 @@ module Muve
9
9
  type: 'Place',
10
10
  coordinates: [resource.longitude, resource.latitude]
11
11
  } if resource.kind_of? Muve::Location
12
+ return resource.name if resource.kind_of? Muve::Traveller
12
13
  resource
13
14
  end
14
15
 
15
- def self.convert_from_storeable_object(storeable)
16
+ def self.convert_from_storeable_object(storeable, klass=nil)
17
+ if klass
18
+ return {
19
+ id: storeable[:id],
20
+ name: storeable[:name],
21
+ location: (Location.new({
22
+ latitude: storeable[:location]["coordinates"][1],
23
+ longitude: storeable[:location]["coordinates"][0]
24
+ }) if storeable[:location] && storeable[:location]["coordinates"])
25
+ } if (klass < Muve::Place)
26
+
27
+ return {
28
+ id: storeable[:id],
29
+ time: storeable[:time],
30
+ traveller: Traveller.new(name: storeable[:traveller]),
31
+ location: Location.new(
32
+ latitude: storeable[:location]["coordinates"][1],
33
+ longitude: storeable[:location]["coordinates"][0]
34
+ )
35
+ } if (klass < Muve::Movement)
36
+ end
37
+
16
38
  if storeable.kind_of? Hash
17
39
  if Helper.symbolize_keys(storeable).to_a.include? [:type, 'Place']
18
40
  Location.new(latitude: storeable[:coordinates][1], longitude: storeable[:coordinates][0]) if storeable[:coordinates]
@@ -1,7 +1,7 @@
1
1
  module Muve
2
2
  module Store
3
3
  module Mongo
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -11,10 +11,10 @@ describe 'Mongo Adaptor' do
11
11
 
12
12
  before do
13
13
  class Place
14
- attr_accessor :city, :street, :building, :name
15
-
16
14
  include Muve::Model
17
15
 
16
+ with_fields :city, :street, :building, :name
17
+
18
18
  def self.container
19
19
  'places'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muve-store-mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Asabina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: muve