wideopenspaces-flickry 0.1.3 → 0.1.5

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 ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 1
3
+ :patch: 5
4
+ :major: 0
data/lib/flickry/base.rb CHANGED
@@ -39,5 +39,9 @@ module Flickry
39
39
  end
40
40
  return str
41
41
  end
42
+
43
+ def clean(text)
44
+ text.gsub(' ','').gsub("\\",'')
45
+ end
42
46
  end
43
47
  end
@@ -0,0 +1,38 @@
1
+ module Flickry
2
+ class Comment < Flickry::Base
3
+ def initialize(comment)
4
+ super(nil)
5
+ extract_attrs!(comment, [:fid, :authorname, :datecreate, :permalink])
6
+ self.content = comment.to_s
7
+ self.author_id = comment.author
8
+ end
9
+
10
+ def comment_id
11
+ self.fid
12
+ end
13
+
14
+ def to_s
15
+ self.content
16
+ end
17
+
18
+ # Clean permalink
19
+ def to_url
20
+ clean(self.permalink)
21
+ end
22
+
23
+ # datecreate converted into Time object
24
+ def created_at
25
+ Time.at(self.datecreate.to_i)
26
+ end
27
+
28
+ # Get a Person record for the author_id
29
+ def author
30
+ Flickry::Person.find(self.author_id)
31
+ end
32
+
33
+ # name = authornane
34
+ def name
35
+ self.authorname
36
+ end
37
+ end
38
+ end
@@ -2,7 +2,23 @@ module Flickry
2
2
  class Person < Flickry::Base
3
3
  def initialize(user)
4
4
  super(nil)
5
- extract_attrs!(user, [:location, :nsid, :realname, :username])
5
+ extract_attrs!(user, [:location, :nsid, :realname, :username, :photosurl, :profileurl])
6
+ end
7
+
8
+ def self.find(nsid)
9
+ if person = flickr.people.getInfo(:user_id => nsid)
10
+ return new(person)
11
+ else
12
+ return nil
13
+ end
14
+ end
15
+
16
+ def profile
17
+ clean(self.profileurl)
18
+ end
19
+
20
+ def photos
21
+ clean(self.photosurl)
6
22
  end
7
23
  end
8
24
  end
data/lib/flickry/photo.rb CHANGED
@@ -3,9 +3,10 @@ module Flickry
3
3
  def initialize(flickr_id)
4
4
  super(nil)
5
5
  foto = flickr.photos.getInfo(:photo_id => flickr_id)
6
+ self.raw_photo = foto
6
7
  self.photo_id = flickr_id
7
8
 
8
- extract_attrs!(foto, [:comments, :dateuploaded, :description, :farm, :id, :isfavorite, :license,
9
+ extract_attrs!(foto, [:dateuploaded, :description, :farm, :id, :isfavorite, :license,
9
10
  :media, :notes, :originalformat, :originalsecret, :rotation, :secret, :server, :tags,
10
11
  :title, :urls])
11
12
  extract_attrs_into_substructs!(foto, {
@@ -17,10 +18,30 @@ module Flickry
17
18
  })
18
19
  self.location = Flickry::Location.new(foto.respond_to?(:location) ? foto.location : nil)
19
20
  self.owner = Flickry::Person.new(foto.respond_to?(:owner) ? foto.owner : nil)
20
-
21
- self.sizes = Flickry::Sizes.new(flickr.photos.getSizes(:photo_id => self.photo_id))
21
+
22
+ end
23
+
24
+ # Lazily fetches the photo's sizes when called, memoizes so later calls are faster...
25
+ def sizes
26
+ @sizes ||= Flickry::Sizes.new(flickr.photos.getSizes(:photo_id => self.photo_id))
22
27
  end
23
28
 
29
+ # Lazily fetches the photo's comments when called, memoizes so later calls are faster...
30
+ def comments
31
+ return @comments if @comments
32
+
33
+ if raw_photo.comments.to_i == 0
34
+ @comments = []
35
+ else
36
+ @comments = []
37
+ flickr_comments = flickr.photos.comments.getList(:photo_id => self.photo_id)
38
+ flickr_comments.each do |comment|
39
+ @comments << Flickry::Comment.new(comment)
40
+ end
41
+ end
42
+ return @comments
43
+ end
44
+
24
45
  def visible_to_family?
25
46
  self.visibility.isfamily == 1
26
47
  end
@@ -32,20 +53,6 @@ module Flickry
32
53
  def visible_to_public?
33
54
  self.visibility.ispublic == 1
34
55
  end
35
-
36
- def to_flickr_photo
37
- { :secret => self.secret,
38
- :originalsecret => self.originalsecret,
39
- :farm => self.farm,
40
- :server => self.server,
41
- :content_type => self.originalformat,
42
- :content => self.description,
43
- :created_at => Time.parse(self.dates.taken) }
44
- end
45
-
46
- def to_story
47
- return {:title => self.title, :slug => self.photo_id, :published_at => self.dates.taken }
48
- end
49
-
56
+
50
57
  end
51
58
  end
data/lib/flickry/size.rb CHANGED
@@ -13,9 +13,5 @@ module Flickry
13
13
  clean(self.source)
14
14
  end
15
15
 
16
- protected
17
- def clean(text)
18
- text.gsub(' ','').gsub("\\",'')
19
- end
20
16
  end
21
17
  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.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Stetser
@@ -9,17 +9,17 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-16 00:00:00 -08:00
12
+ date: 2009-01-21 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: flickraw
16
+ name: wideopenspaces-flickraw
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - "="
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.4.5
22
+ version: 0.5.2
23
23
  version:
24
24
  description: Interface to Flickr API to make working with API responses safer and easier. DO NOT USE ME YET!
25
25
  email: jake@wideopenspac.es
@@ -30,14 +30,10 @@ extensions: []
30
30
  extra_rdoc_files: []
31
31
 
32
32
  files:
33
- - MIT-LICENSE
34
- - README
35
- - Rakefile
36
- - flickry.gemspec
37
- - init.rb
38
- - install.rb
33
+ - VERSION.yml
39
34
  - lib/flickry
40
35
  - lib/flickry/base.rb
36
+ - lib/flickry/comment.rb
41
37
  - lib/flickry/location.rb
42
38
  - lib/flickry/person.rb
43
39
  - lib/flickry/photo.rb
@@ -45,14 +41,14 @@ files:
45
41
  - lib/flickry/sizes.rb
46
42
  - lib/flickry.rb
47
43
  - lib/super_struct.rb
48
- - rails/init.rb
49
- - tasks/flickry_tasks.rake
50
- - uninstall.rb
44
+ - test/flickry_test.rb
45
+ - test/test_helper.rb
51
46
  has_rdoc: true
52
47
  homepage: http://github.com/wideopenspaces/flickry
53
48
  post_install_message:
54
- rdoc_options: []
55
-
49
+ rdoc_options:
50
+ - --inline-source
51
+ - --charset=UTF-8
56
52
  require_paths:
57
53
  - lib
58
54
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -69,11 +65,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
65
  version:
70
66
  requirements: []
71
67
 
72
- rubyforge_project: flickry
68
+ rubyforge_project:
73
69
  rubygems_version: 1.2.0
74
70
  signing_key:
75
71
  specification_version: 2
76
72
  summary: Friendlier interface to flickr API, uses flickraw underneath
77
- test_files:
78
- - test/flickry_test.rb
79
- - test/test_helper.rb
73
+ test_files: []
74
+
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 [name of plugin creator]
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README DELETED
@@ -1,13 +0,0 @@
1
- Flickry
2
- =======
3
-
4
- Introduction goes here.
5
-
6
-
7
- Example
8
- =======
9
-
10
- Example goes here.
11
-
12
-
13
- Copyright (c) 2008 [name of plugin creator], released under the MIT license
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the flickry plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/*_test.rb'
13
- t.verbose = true
14
- end
15
-
16
- desc 'Generate documentation for the flickry plugin.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
18
- rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = 'Flickry'
20
- rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
23
- end
data/flickry.gemspec DELETED
@@ -1,35 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "flickry"
3
- s.version = "0.1.3"
4
- s.date = "2008-11-16"
5
- s.summary = "Friendlier interface to flickr API, uses flickraw underneath"
6
- s.email = "jake@wideopenspac.es"
7
- s.homepage = "http://github.com/wideopenspaces/flickry"
8
- s.rubyforge_project = "flickry"
9
- s.description = "Interface to Flickr API to make working with API responses safer and easier. DO NOT USE ME YET!"
10
- s.has_rdoc = true
11
- s.authors = ["Jacob Stetser"]
12
- s.files = ["MIT-LICENSE",
13
- "README",
14
- "Rakefile",
15
- "flickry.gemspec",
16
- "init.rb",
17
- "install.rb",
18
- "lib/flickry",
19
- "lib/flickry/base.rb",
20
- "lib/flickry/location.rb",
21
- "lib/flickry/person.rb",
22
- "lib/flickry/photo.rb",
23
- "lib/flickry/size.rb",
24
- "lib/flickry/sizes.rb",
25
- "lib/flickry.rb",
26
- "lib/super_struct.rb",
27
- "rails/init.rb",
28
- "tasks/flickry_tasks.rake",
29
- "uninstall.rb"]
30
- s.test_files = ["test/flickry_test.rb",
31
- "test/test_helper.rb"]
32
- s.rdoc_options = []
33
- s.extra_rdoc_files = []
34
- s.add_dependency("flickraw", [" 0.4.5"])
35
- end
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require File.dirname(__FILE__) + "/rails/init"
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
data/rails/init.rb DELETED
@@ -1,21 +0,0 @@
1
- # Copyright (c) 2008 Jacob Stetser
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
20
-
21
- require 'flickry'
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :flickry do
3
- # # Task goes here
4
- # end
data/uninstall.rb DELETED
@@ -1 +0,0 @@
1
- # Uninstall hook code here