flickrie 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/flickrie.rb CHANGED
@@ -63,6 +63,12 @@ module Flickrie
63
63
  Video.from_sizes(response.body['sizes'])
64
64
  end
65
65
 
66
+ def remove_media_tag(tag_id)
67
+ client.remove_media_tag(tag_id)
68
+ end
69
+ alias remove_photo_tag remove_media_tag
70
+ alias remove_video_tag remove_media_tag
71
+
66
72
  def search_media(search_params = {})
67
73
  response = client.search_media(search_params)
68
74
  Media.from_search(response.body['photos'])
@@ -0,0 +1,25 @@
1
+ module Flickrie
2
+ module Media
3
+ class Tag
4
+ def id; @info['id'] end
5
+ def raw; @info['raw'] end
6
+ def content; @info['_content'] end
7
+
8
+ def machine_tag?
9
+ @info['machine_tag'].to_i == 1
10
+ end
11
+
12
+ def author
13
+ User.new('nsid' => @info['author'])
14
+ end
15
+
16
+ def initialize(info)
17
+ @info = info
18
+ end
19
+
20
+ def to_s
21
+ content
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Flickrie
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/test/media_test.rb CHANGED
@@ -270,14 +270,24 @@ class MediaTest < Test::Unit::TestCase
270
270
  end
271
271
 
272
272
  def test_add_media_tags
273
- media = Flickrie.get_photo_info(@media_id)
273
+ media = Flickrie.get_media_info(@media_id)
274
274
  tags_before_change = media.tags.join(' ')
275
275
  Flickrie.add_media_tags(@media_id, "janko")
276
276
  media.get_info
277
277
  assert_equal [tags_before_change, "janko"].join(' '),
278
278
  media.tags.join(' ')
279
279
  tag_id = media.tags.find { |tag| tag.content == "janko" }.id
280
- Flickrie.client.remove_media_tag(tag_id)
280
+ Flickrie.remove_media_tag(tag_id)
281
+ end
282
+
283
+ def test_remove_media_tag
284
+ Flickrie.add_media_tags(@media_id, "janko")
285
+ media = Flickrie.get_media_info(@media_id)
286
+ tags_before_change = media.tags.join(' ')
287
+ tag_id = media.tags.find { |tag| tag.content == "janko" }.id
288
+ Flickrie.remove_media_tag(tag_id)
289
+ media.get_info
290
+ assert_equal media.tags.join(' '), tags_before_change.chomp("janko").rstrip
281
291
  end
282
292
 
283
293
  def test_methods_returning_nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickrie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday_middleware
16
- requirement: &70192223006740 !ruby/object:Gem::Requirement
16
+ requirement: &70309320225020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70192223006740
24
+ version_requirements: *70309320225020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simple_oauth
27
- requirement: &70192223005740 !ruby/object:Gem::Requirement
27
+ requirement: &70309320251620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70192223005740
35
+ version_requirements: *70309320251620
36
36
  description: This gem is a nice wrapper for the Flickr API with an intuitive interface.
37
37
  email:
38
38
  - janko.marohnic@gmail.com
@@ -53,6 +53,7 @@ files:
53
53
  - lib/flickrie/location.rb
54
54
  - lib/flickrie/media.rb
55
55
  - lib/flickrie/media/note.rb
56
+ - lib/flickrie/media/tag.rb
56
57
  - lib/flickrie/media/visibility.rb
57
58
  - lib/flickrie/oauth.rb
58
59
  - lib/flickrie/photo.rb