myflickr 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,7 +1,12 @@
1
+ == 0.1.4 2008-01-18
2
+
3
+ * Added a user class for retrieval of username, realname
4
+ * Changed the way machine tags are associated with a photo, no api change
5
+ * Added a taken time to photos
6
+
1
7
  == 0.1.3 2008-01-18
2
8
 
3
9
  * Machine tags aren't included in the tags for a photo any longer
4
- *
5
10
 
6
11
  == 0.1.2 2008-01-15
7
12
 
data/lib/myflickr.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ require 'time'
2
3
  require 'hpricot'
3
4
  require 'openuri_memcached'
4
5
  require 'vendor/parallel/parallel'
@@ -1,5 +1,5 @@
1
1
  module Myflickr
2
- class Photo < Struct.new :id, :title, :description, :tags, :machine_tags
2
+ class Photo < Struct.new :id, :title, :description, :tags, :machine_tags, :taken
3
3
  attr_reader :sizes
4
4
 
5
5
  # Get recent photos
@@ -18,9 +18,10 @@ module Myflickr
18
18
 
19
19
  # Set basic attributes
20
20
  photo = Photo.new(id, *%w(title description).map {|a| (photo_call/a).inner_text })
21
+ photo.taken = Time.parse(photo_call.at(:dates)['taken'])
21
22
 
22
23
  # Set tags for photo
23
- photo.tags = (photo_call/:tag).map{|tag| Tag.new tag.inner_text unless /(.*)\:(.*)\=(.*)/ }
24
+ photo.tags = (photo_call/"tag[@machine_tag=0]").map{|tag| Tag.new tag.inner_text }
24
25
  photo.machine_tags = (photo_call/"tag[@machine_tag=1]").map{|tag| MachineTag.from_s tag.inner_text }
25
26
 
26
27
  return photo
@@ -2,7 +2,7 @@ module Myflickr
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/spec/photo_spec.rb CHANGED
@@ -24,6 +24,11 @@ describe Photo, "class" do
24
24
  tags.first.should be_an_instance_of(Tag)
25
25
  end
26
26
 
27
+ it "should have a taken time" do
28
+ photo = Photo.find("252091410")
29
+ photo.taken.should be_an_instance_of(Time)
30
+ end
31
+
27
32
  it "should have machine_tags" do
28
33
  Photo.public_instance_methods.should include "machine_tags"
29
34
  machine_tags = Photo.find("252091410").machine_tags
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myflickr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Schwarz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-18 00:00:00 +11:00
12
+ date: 2008-01-19 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency