rdayone 0.2.0 → 0.3.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/.travis.yml +3 -0
- data/README.md +9 -3
- data/lib/rdayone/entry.rb +7 -3
- data/lib/rdayone/entry_list.rb +4 -0
- data/lib/rdayone/location.rb +4 -4
- data/lib/rdayone/version.rb +1 -1
- data/spec/fixtures/entries/1A80AAD1BC71440891993A4637DBCB1E.doentry +42 -0
- data/spec/rdayone/entry_list_spec.rb +14 -2
- data/spec/spec_helper.rb +2 -1
- metadata +6 -4
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -27,10 +27,16 @@ journal = Rdayone::Journal.new("/path/to/Journal.dayone")
|
|
27
27
|
journal.entries # An Enumerable array like object that contains all your entries
|
28
28
|
```
|
29
29
|
|
30
|
-
##
|
30
|
+
## Supported features
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
* Basic entry data - text, creation date and the photo if one exists.
|
33
|
+
* Entry location data
|
34
|
+
* Sorting of entry data (default is ascending date order - a method is
|
35
|
+
supplied to sort by descending date order)
|
36
|
+
|
37
|
+
## Supported rubies
|
38
|
+
|
39
|
+
1.8.7, 1.9.2, rbx and jruby
|
34
40
|
|
35
41
|
## Contributing
|
36
42
|
|
data/lib/rdayone/entry.rb
CHANGED
@@ -8,12 +8,16 @@ module Rdayone
|
|
8
8
|
@plist_hash = plist_hash
|
9
9
|
@photo = photo
|
10
10
|
@attribute_mappings = {
|
11
|
-
text
|
12
|
-
creation_date
|
13
|
-
identifier
|
11
|
+
:text => "Entry Text",
|
12
|
+
:creation_date => "Creation Date",
|
13
|
+
:identifier => "UUID"
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
|
+
def <=>(other)
|
18
|
+
self.creation_date <=> other.creation_date
|
19
|
+
end
|
20
|
+
|
17
21
|
def location
|
18
22
|
Location.new(@plist_hash["Location"])
|
19
23
|
end
|
data/lib/rdayone/entry_list.rb
CHANGED
data/lib/rdayone/location.rb
CHANGED
@@ -7,10 +7,10 @@ module Rdayone
|
|
7
7
|
def initialize(plist_hash)
|
8
8
|
@plist_hash = plist_hash
|
9
9
|
@attribute_mappings = {
|
10
|
-
latitude
|
11
|
-
longitude
|
12
|
-
place_name
|
13
|
-
locality
|
10
|
+
:latitude => "Latitude",
|
11
|
+
:longitude => "Longitude",
|
12
|
+
:place_name => "Place Name",
|
13
|
+
:locality => "Locality"
|
14
14
|
}
|
15
15
|
end
|
16
16
|
end
|
data/lib/rdayone/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Creation Date</key>
|
6
|
+
<date>2012-08-07T08:44:28Z</date>
|
7
|
+
<key>Entry Text</key>
|
8
|
+
<string>Took a wander around the Mall on the way to work. This is the back of Horse Guards</string>
|
9
|
+
<key>Location</key>
|
10
|
+
<dict>
|
11
|
+
<key>Administrative Area</key>
|
12
|
+
<string>England</string>
|
13
|
+
<key>Country</key>
|
14
|
+
<string>United Kingdom</string>
|
15
|
+
<key>Latitude</key>
|
16
|
+
<real>51.505845000000001</real>
|
17
|
+
<key>Locality</key>
|
18
|
+
<string>London</string>
|
19
|
+
<key>Longitude</key>
|
20
|
+
<real>-0.1308377</real>
|
21
|
+
<key>Place Name</key>
|
22
|
+
<string>The Mall</string>
|
23
|
+
<key>State</key>
|
24
|
+
<string>manual</string>
|
25
|
+
</dict>
|
26
|
+
<key>Starred</key>
|
27
|
+
<false/>
|
28
|
+
<key>UUID</key>
|
29
|
+
<string>1A80AAD1BC71440891993A4637DBCB1E</string>
|
30
|
+
<key>Weather</key>
|
31
|
+
<dict>
|
32
|
+
<key>Celsius</key>
|
33
|
+
<string>15</string>
|
34
|
+
<key>Description</key>
|
35
|
+
<string>Partly Cloudy</string>
|
36
|
+
<key>Fahrenheit</key>
|
37
|
+
<string>59</string>
|
38
|
+
<key>IconName</key>
|
39
|
+
<string>pcloudy.png</string>
|
40
|
+
</dict>
|
41
|
+
</dict>
|
42
|
+
</plist>
|
@@ -31,12 +31,24 @@ describe Rdayone::EntryList do
|
|
31
31
|
it "implements each" do
|
32
32
|
entries = []
|
33
33
|
subject.each { |e| entries << e }
|
34
|
-
expect(entries.count).to eq(
|
34
|
+
expect(entries.count).to eq(2)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "is Enumerable" do
|
38
38
|
mapresult = subject.map { |e| e.text }
|
39
|
-
expect(mapresult).to eq(
|
39
|
+
expect(mapresult[0]).to eq("Something cool happened in London")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "is sortable in ascending creation date order" do
|
43
|
+
sorted = subject.sort
|
44
|
+
expect(sorted[0].identifier).to eq("1A80AAD1BC71440891993A4637DBCB1E")
|
45
|
+
expect(sorted[1].identifier).to eq("02B82925942747709E1DF0518A650E1B")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "is sortable in descending creation date order" do
|
49
|
+
sorted = subject.sort_desc
|
50
|
+
expect(sorted[0].identifier).to eq("02B82925942747709E1DF0518A650E1B")
|
51
|
+
expect(sorted[1].identifier).to eq("1A80AAD1BC71440891993A4637DBCB1E")
|
40
52
|
end
|
41
53
|
end
|
42
54
|
|
data/spec/spec_helper.rb
CHANGED
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.3.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-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plist
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/rdayone/version.rb
|
84
84
|
- rdayone.gemspec
|
85
85
|
- spec/fixtures/entries/02B82925942747709E1DF0518A650E1B.doentry
|
86
|
+
- spec/fixtures/entries/1A80AAD1BC71440891993A4637DBCB1E.doentry
|
86
87
|
- spec/fixtures/photos/02B82925942747709E1DF0518A650E1B.jpg
|
87
88
|
- spec/rdayone/entry_list_spec.rb
|
88
89
|
- spec/rdayone/entry_spec.rb
|
@@ -104,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
105
|
version: '0'
|
105
106
|
segments:
|
106
107
|
- 0
|
107
|
-
hash: -
|
108
|
+
hash: -2211371097992317125
|
108
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
110
|
none: false
|
110
111
|
requirements:
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
version: '0'
|
114
115
|
segments:
|
115
116
|
- 0
|
116
|
-
hash: -
|
117
|
+
hash: -2211371097992317125
|
117
118
|
requirements: []
|
118
119
|
rubyforge_project:
|
119
120
|
rubygems_version: 1.8.23
|
@@ -122,6 +123,7 @@ specification_version: 3
|
|
122
123
|
summary: Access Day One journals from ruby.
|
123
124
|
test_files:
|
124
125
|
- spec/fixtures/entries/02B82925942747709E1DF0518A650E1B.doentry
|
126
|
+
- spec/fixtures/entries/1A80AAD1BC71440891993A4637DBCB1E.doentry
|
125
127
|
- spec/fixtures/photos/02B82925942747709E1DF0518A650E1B.jpg
|
126
128
|
- spec/rdayone/entry_list_spec.rb
|
127
129
|
- spec/rdayone/entry_spec.rb
|