wideopenspaces-flickry 0.1.6 → 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/VERSION.yml +2 -2
- data/lib/flickry.rb +1 -0
- data/lib/flickry/comment.rb +10 -21
- data/lib/flickry/location.rb +11 -1
- data/lib/flickry/photo.rb +10 -1
- data/lib/flickry/place.rb +12 -0
- data/lib/flickry/tag.rb +21 -0
- metadata +3 -1
data/VERSION.yml
CHANGED
data/lib/flickry.rb
CHANGED
data/lib/flickry/comment.rb
CHANGED
@@ -1,39 +1,28 @@
|
|
1
1
|
module Flickry
|
2
|
-
class Comment <
|
2
|
+
class Comment < String
|
3
|
+
attr_reader :comment_id, :author_id, :authorname, :datecreate, :permalink
|
3
4
|
def initialize(comment)
|
4
|
-
super(
|
5
|
+
super(comment.to_s)
|
5
6
|
@comment_id = comment.id
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def comment_id
|
12
|
-
@comment_id
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_s
|
16
|
-
self.content
|
17
|
-
end
|
18
|
-
|
19
|
-
# Clean permalink
|
20
|
-
def to_url
|
21
|
-
clean(self.permalink)
|
7
|
+
@author_id = comment.author
|
8
|
+
@authorname = comment.authorname
|
9
|
+
@datecreate = comment.datecreate
|
10
|
+
@permalink = comment.permalink
|
22
11
|
end
|
23
12
|
|
24
13
|
# datecreate converted into Time object
|
25
14
|
def created_at
|
26
|
-
Time.at(
|
15
|
+
Time.at(@datecreate.to_i)
|
27
16
|
end
|
28
17
|
|
29
18
|
# Get a Person record for the author_id
|
30
19
|
def author
|
31
|
-
Flickry::Person.find(
|
20
|
+
Flickry::Person.find(@author_id)
|
32
21
|
end
|
33
22
|
|
34
23
|
# name = authornane
|
35
24
|
def name
|
36
|
-
|
25
|
+
@authorname
|
37
26
|
end
|
38
27
|
end
|
39
28
|
end
|
data/lib/flickry/location.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
+
require 'flickry/place'
|
2
|
+
|
1
3
|
module Flickry
|
2
4
|
class Location < Flickry::Base
|
3
5
|
def initialize(locus)
|
4
6
|
super(nil)
|
5
|
-
extract_attrs!(locus, [:accuracy, :
|
7
|
+
extract_attrs!(locus, [:accuracy, :latitude, :longitude, :place_id, :woeid])
|
8
|
+
|
9
|
+
[:country, :county, :locality, :neighbourhood, :region].each do |scale|
|
10
|
+
if locus.respond_to?(scale) and loc = locus.send(scale)
|
11
|
+
self[scale] = Flickry::Place.new(loc, scale)
|
12
|
+
else
|
13
|
+
self[scale] = nil
|
14
|
+
end
|
15
|
+
end
|
6
16
|
end
|
7
17
|
end
|
8
18
|
end
|
data/lib/flickry/photo.rb
CHANGED
@@ -18,7 +18,11 @@ module Flickry
|
|
18
18
|
})
|
19
19
|
self.location = Flickry::Location.new(foto.respond_to?(:location) ? foto.location : nil)
|
20
20
|
self.owner = Flickry::Person.new(foto.respond_to?(:owner) ? foto.owner : nil)
|
21
|
-
|
21
|
+
|
22
|
+
_tags = self.tags.dup
|
23
|
+
self.tags = _tags.collect do |t|
|
24
|
+
Flickry::Tag.new(t)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
# Lazily fetches the photo's sizes when called, memoizes so later calls are faster...
|
@@ -42,6 +46,11 @@ module Flickry
|
|
42
46
|
return @comments
|
43
47
|
end
|
44
48
|
|
49
|
+
# Join tags into a single string
|
50
|
+
def tag_list(separator = ', ')
|
51
|
+
self.tags.join(separator)
|
52
|
+
end
|
53
|
+
|
45
54
|
def visible_to_family?
|
46
55
|
self.visibility.isfamily == 1
|
47
56
|
end
|
data/lib/flickry/tag.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Flickry
|
2
|
+
class Tag < String
|
3
|
+
attr_reader :tag_id, :machine_tag, :author_id, :name
|
4
|
+
def initialize(tag)
|
5
|
+
super(tag.to_s)
|
6
|
+
@tag_id = tag.id
|
7
|
+
@machine_tag = tag.machine_tag
|
8
|
+
@author_id = tag.author
|
9
|
+
@name = self.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def machine_tag?
|
13
|
+
@machine_tag == 0 ? false : true
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get a Person record for the author_id
|
17
|
+
def author
|
18
|
+
Flickry::Person.find(@author_id)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wideopenspaces-flickry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Stetser
|
@@ -37,8 +37,10 @@ files:
|
|
37
37
|
- lib/flickry/location.rb
|
38
38
|
- lib/flickry/person.rb
|
39
39
|
- lib/flickry/photo.rb
|
40
|
+
- lib/flickry/place.rb
|
40
41
|
- lib/flickry/size.rb
|
41
42
|
- lib/flickry/sizes.rb
|
43
|
+
- lib/flickry/tag.rb
|
42
44
|
- lib/flickry.rb
|
43
45
|
- lib/super_struct.rb
|
44
46
|
- test/flickry_test.rb
|