rdayone 0.1.0 → 0.2.0
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.
- data/README.md +2 -2
- data/lib/rdayone/attribute_mappable.rb +12 -0
- data/lib/rdayone/entry.rb +5 -8
- data/lib/rdayone/location.rb +17 -0
- data/lib/rdayone/version.rb +1 -1
- data/lib/rdayone.rb +2 -0
- data/spec/rdayone/entry_spec.rb +21 -3
- data/spec/rdayone/location_spec.rb +21 -0
- metadata +8 -4
data/README.md
CHANGED
@@ -29,8 +29,8 @@ journal.entries # An Enumerable array like object that contains all your entries
|
|
29
29
|
|
30
30
|
## NOTE
|
31
31
|
|
32
|
-
This is a *very* early release. Entries currently contain the entry text
|
33
|
-
|
32
|
+
This is a *very* early release. Entries currently contain the entry text, date and paths
|
33
|
+
to related photos only.
|
34
34
|
|
35
35
|
## Contributing
|
36
36
|
|
data/lib/rdayone/entry.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Rdayone
|
2
2
|
class Entry
|
3
|
-
attr_reader :photo
|
3
|
+
attr_reader :photo, :plist_hash, :attribute_mappings
|
4
|
+
|
5
|
+
include Rdayone::AttributeMappable
|
4
6
|
|
5
7
|
def initialize(plist_hash = {}, photo = nil)
|
6
8
|
@plist_hash = plist_hash
|
@@ -12,13 +14,8 @@ module Rdayone
|
|
12
14
|
}
|
13
15
|
end
|
14
16
|
|
15
|
-
def
|
16
|
-
|
17
|
-
if key
|
18
|
-
@plist_hash[key]
|
19
|
-
else
|
20
|
-
super
|
21
|
-
end
|
17
|
+
def location
|
18
|
+
Location.new(@plist_hash["Location"])
|
22
19
|
end
|
23
20
|
end
|
24
21
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Rdayone
|
2
|
+
class Location
|
3
|
+
attr_reader :plist_hash, :attribute_mappings
|
4
|
+
|
5
|
+
include Rdayone::AttributeMappable
|
6
|
+
|
7
|
+
def initialize(plist_hash)
|
8
|
+
@plist_hash = plist_hash
|
9
|
+
@attribute_mappings = {
|
10
|
+
latitude: "Latitude",
|
11
|
+
longitude: "Longitude",
|
12
|
+
place_name: "Place Name",
|
13
|
+
locality: "Locality"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rdayone/version.rb
CHANGED
data/lib/rdayone.rb
CHANGED
data/spec/rdayone/entry_spec.rb
CHANGED
@@ -23,10 +23,21 @@ describe Rdayone::Entry do
|
|
23
23
|
context "basic parsing" do
|
24
24
|
let(:creation_date) { DateTime.new }
|
25
25
|
|
26
|
+
let(:hash) do
|
27
|
+
{
|
28
|
+
"Creation Date" => creation_date,
|
29
|
+
"Entry Text" => "something cool happened today",
|
30
|
+
"UUID" => "02B82925942747709E1DF0518A650E1B",
|
31
|
+
"Location" => {
|
32
|
+
"Latitude" => 51.505845,
|
33
|
+
"Longitude" => 0.1308377,
|
34
|
+
"Place Name" => "The Mall",
|
35
|
+
"Locality" => "London"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
26
40
|
subject do
|
27
|
-
hash = { "Creation Date" => creation_date,
|
28
|
-
"Entry Text" => "something cool happened today",
|
29
|
-
"UUID" => "02B82925942747709E1DF0518A650E1B"}
|
30
41
|
Rdayone::Entry.new(hash)
|
31
42
|
end
|
32
43
|
|
@@ -41,5 +52,12 @@ describe Rdayone::Entry do
|
|
41
52
|
it "populates the creation date" do
|
42
53
|
expect(subject.creation_date).to eq(creation_date)
|
43
54
|
end
|
55
|
+
|
56
|
+
context "location" do
|
57
|
+
it "returns a new location with the contents of the Location hash" do
|
58
|
+
Rdayone::Location.should_receive(:new).with(hash["Location"])
|
59
|
+
subject.location
|
60
|
+
end
|
61
|
+
end
|
44
62
|
end
|
45
63
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rdayone::Location do
|
4
|
+
let(:hash) do
|
5
|
+
{
|
6
|
+
"Latitude" => 51.505845,
|
7
|
+
"Longitude" => 0.1308377,
|
8
|
+
"Place Name" => "The Mall",
|
9
|
+
"Locality" => "London"
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
subject { Rdayone::Location.new(hash) }
|
14
|
+
|
15
|
+
it "populates the basic attributes" do
|
16
|
+
expect(subject.latitude).to eq(51.505845)
|
17
|
+
expect(subject.longitude).to eq(0.1308377)
|
18
|
+
expect(subject.place_name).to eq("The Mall")
|
19
|
+
expect(subject.locality).to eq("London")
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdayone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plist
|
@@ -74,10 +74,12 @@ files:
|
|
74
74
|
- README.md
|
75
75
|
- Rakefile
|
76
76
|
- lib/rdayone.rb
|
77
|
+
- lib/rdayone/attribute_mappable.rb
|
77
78
|
- lib/rdayone/entry.rb
|
78
79
|
- lib/rdayone/entry_list.rb
|
79
80
|
- lib/rdayone/finder.rb
|
80
81
|
- lib/rdayone/journal.rb
|
82
|
+
- lib/rdayone/location.rb
|
81
83
|
- lib/rdayone/version.rb
|
82
84
|
- rdayone.gemspec
|
83
85
|
- spec/fixtures/entries/02B82925942747709E1DF0518A650E1B.doentry
|
@@ -86,6 +88,7 @@ files:
|
|
86
88
|
- spec/rdayone/entry_spec.rb
|
87
89
|
- spec/rdayone/finder_spec.rb
|
88
90
|
- spec/rdayone/journal_spec.rb
|
91
|
+
- spec/rdayone/location_spec.rb
|
89
92
|
- spec/spec_helper.rb
|
90
93
|
homepage: http://github.com/simonjefford/rdayone
|
91
94
|
licenses: []
|
@@ -101,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
104
|
version: '0'
|
102
105
|
segments:
|
103
106
|
- 0
|
104
|
-
hash:
|
107
|
+
hash: -1736936606859133392
|
105
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
109
|
none: false
|
107
110
|
requirements:
|
@@ -110,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
113
|
version: '0'
|
111
114
|
segments:
|
112
115
|
- 0
|
113
|
-
hash:
|
116
|
+
hash: -1736936606859133392
|
114
117
|
requirements: []
|
115
118
|
rubyforge_project:
|
116
119
|
rubygems_version: 1.8.23
|
@@ -124,4 +127,5 @@ test_files:
|
|
124
127
|
- spec/rdayone/entry_spec.rb
|
125
128
|
- spec/rdayone/finder_spec.rb
|
126
129
|
- spec/rdayone/journal_spec.rb
|
130
|
+
- spec/rdayone/location_spec.rb
|
127
131
|
- spec/spec_helper.rb
|