flickr-objects 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.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +49 -63
  3. data/lib/flickr/api/abstract/params_processor.rb +68 -0
  4. data/lib/flickr/api/abstract.rb +113 -0
  5. data/lib/flickr/api/general.rb +75 -0
  6. data/lib/flickr/api/person.rb +91 -39
  7. data/lib/flickr/api/photo.rb +213 -108
  8. data/lib/flickr/api/set.rb +114 -55
  9. data/lib/flickr/api/upload_ticket.rb +17 -6
  10. data/lib/flickr/api.rb +90 -35
  11. data/lib/flickr/attributes.rb +200 -0
  12. data/lib/flickr/base_converter.rb +29 -0
  13. data/lib/flickr/client/data.rb +47 -0
  14. data/lib/flickr/client/oauth.rb +44 -0
  15. data/lib/flickr/client/upload.rb +55 -0
  16. data/lib/flickr/client.rb +77 -33
  17. data/lib/flickr/configuration.rb +85 -14
  18. data/lib/flickr/error.rb +58 -0
  19. data/lib/flickr/middleware.rb +52 -28
  20. data/lib/flickr/oauth.rb +89 -74
  21. data/lib/flickr/object/attribute_locations/list.rb +25 -0
  22. data/lib/flickr/object/attribute_locations/location.rb +29 -0
  23. data/lib/flickr/object/attribute_locations/permissions.rb +31 -0
  24. data/lib/flickr/object/attribute_locations/person/upload_status.rb +32 -0
  25. data/lib/flickr/object/attribute_locations/person.rb +78 -0
  26. data/lib/flickr/object/attribute_locations/photo/exif.rb +29 -0
  27. data/lib/flickr/object/attribute_locations/photo/note.rb +36 -0
  28. data/lib/flickr/object/attribute_locations/photo/tag.rb +23 -0
  29. data/lib/flickr/object/attribute_locations/photo.rb +164 -0
  30. data/lib/flickr/object/attribute_locations/set.rb +53 -0
  31. data/lib/flickr/object/attribute_locations/upload_ticket.rb +30 -0
  32. data/lib/flickr/object/attribute_locations/visibility.rb +24 -0
  33. data/lib/flickr/object/list/kaminari.rb +30 -0
  34. data/lib/flickr/object/list/normal.rb +27 -0
  35. data/lib/flickr/object/list/will_paginate.rb +31 -0
  36. data/lib/flickr/object/list.rb +87 -0
  37. data/lib/flickr/object/location.rb +35 -0
  38. data/lib/flickr/object/permissions.rb +18 -0
  39. data/lib/flickr/object/person/upload_status.rb +22 -0
  40. data/lib/flickr/object/person.rb +93 -0
  41. data/lib/flickr/object/photo/exif.rb +35 -0
  42. data/lib/flickr/object/photo/note.rb +20 -0
  43. data/lib/flickr/object/photo/size.rb +67 -0
  44. data/lib/flickr/object/photo/tag.rb +23 -0
  45. data/lib/flickr/object/photo.rb +349 -0
  46. data/lib/flickr/object/set.rb +114 -0
  47. data/lib/flickr/object/upload_ticket.rb +31 -0
  48. data/lib/flickr/object/visibility.rb +16 -0
  49. data/lib/flickr/object.rb +118 -27
  50. data/lib/flickr/sanitized_file.rb +70 -0
  51. data/lib/flickr/version.rb +4 -2
  52. data/lib/flickr.rb +69 -15
  53. metadata +89 -103
  54. data/lib/flickr/api/api_methods/flickr.rb +0 -5
  55. data/lib/flickr/api/api_methods/person.rb +0 -14
  56. data/lib/flickr/api/api_methods/photo.rb +0 -26
  57. data/lib/flickr/api/api_methods/set.rb +0 -18
  58. data/lib/flickr/api/api_methods/upload_ticket.rb +0 -5
  59. data/lib/flickr/api/flickr.rb +0 -35
  60. data/lib/flickr/api_caller.rb +0 -98
  61. data/lib/flickr/client/methods_client.rb +0 -22
  62. data/lib/flickr/client/upload_client.rb +0 -62
  63. data/lib/flickr/errors.rb +0 -19
  64. data/lib/flickr/helpers/base_58.rb +0 -15
  65. data/lib/flickr/helpers/boolean.rb +0 -4
  66. data/lib/flickr/helpers/core_ext.rb +0 -5
  67. data/lib/flickr/object/attribute/converter.rb +0 -49
  68. data/lib/flickr/object/attribute/finder.rb +0 -32
  69. data/lib/flickr/object/attribute.rb +0 -45
  70. data/lib/flickr/objects/attribute_values/list.rb +0 -10
  71. data/lib/flickr/objects/attribute_values/location.rb +0 -14
  72. data/lib/flickr/objects/attribute_values/note.rb +0 -11
  73. data/lib/flickr/objects/attribute_values/permissions.rb +0 -12
  74. data/lib/flickr/objects/attribute_values/person/upload_status.rb +0 -16
  75. data/lib/flickr/objects/attribute_values/person.rb +0 -24
  76. data/lib/flickr/objects/attribute_values/photo.rb +0 -84
  77. data/lib/flickr/objects/attribute_values/set.rb +0 -17
  78. data/lib/flickr/objects/attribute_values/tag.rb +0 -9
  79. data/lib/flickr/objects/attribute_values/upload_ticket.rb +0 -9
  80. data/lib/flickr/objects/attribute_values/visibility.rb +0 -10
  81. data/lib/flickr/objects/list.rb +0 -86
  82. data/lib/flickr/objects/location.rb +0 -26
  83. data/lib/flickr/objects/note.rb +0 -14
  84. data/lib/flickr/objects/permissions.rb +0 -14
  85. data/lib/flickr/objects/person/upload_status.rb +0 -14
  86. data/lib/flickr/objects/person.rb +0 -43
  87. data/lib/flickr/objects/photo.rb +0 -113
  88. data/lib/flickr/objects/set.rb +0 -29
  89. data/lib/flickr/objects/tag.rb +0 -17
  90. data/lib/flickr/objects/upload_ticket.rb +0 -18
  91. data/lib/flickr/objects/visibility.rb +0 -12
  92. data/lib/flickr/objects.rb +0 -25
@@ -0,0 +1,164 @@
1
+ require "flickr/base_converter"
2
+
3
+ module Flickr
4
+ class Object
5
+
6
+ class Photo
7
+
8
+ attributes.add_locations(
9
+ uploaded_at: [
10
+ -> { @attributes["dateuploaded"] },
11
+ -> { @attributes["dateupload"] },
12
+ ],
13
+ favorite: [
14
+ -> { @attributes["isfavorite"] },
15
+ ],
16
+ posted_at: [
17
+ -> { @attributes["dates"]["posted"] },
18
+ ],
19
+ taken_at: [
20
+ -> { @attributes["dates"]["taken"] },
21
+ -> { @attributes["datetaken"] }
22
+ ],
23
+ taken_at_granularity: [
24
+ -> { @attributes["dates"]["takengranularity"] },
25
+ -> { @attributes["datetakengranularity"] },
26
+ ],
27
+ updated_at: [
28
+ -> { @attributes["dates"]["lastupdate"] },
29
+ -> { @attributes["lastupdate"] },
30
+ ],
31
+ views_count: [
32
+ -> { @attributes["views"] },
33
+ ],
34
+ public_editability: [
35
+ -> { @attributes["publiceditability"] },
36
+ ],
37
+ comments_count: [
38
+ -> { @attributes["comments"]["_content"] },
39
+ ],
40
+ has_people: [
41
+ -> { @attributes["people"]["haspeople"] },
42
+ ],
43
+ safe: [
44
+ -> { safety_level <= 1 },
45
+ ],
46
+ moderate: [
47
+ -> { safety_level == 2 },
48
+ ],
49
+ restricted: [
50
+ -> { safety_level == 3 },
51
+ ],
52
+ notes: [
53
+ -> { @attributes["notes"]["note"] },
54
+ ],
55
+ tags: [
56
+ -> {
57
+ @attributes["tags"]["tag"].map do |hash|
58
+ hash.merge("photo_id" => id)
59
+ end
60
+ },
61
+ -> {
62
+ tags = @attributes["tags"].split(" ").map do |content|
63
+ {"_content" => content, "machine_tag" => 0}
64
+ end
65
+ machine_tags = @attributes["machine_tags"].split(" ").map do |content|
66
+ {"_content" => content, "machine_tag" => 1}
67
+ end
68
+
69
+ tags + machine_tags
70
+ },
71
+ ],
72
+ visibility: [
73
+ -> {
74
+ {
75
+ "ispublic" => @attributes.fetch("ispublic"),
76
+ "isfriend" => @attributes.fetch("isfriend"),
77
+ "isfamily" => @attributes.fetch("isfamily"),
78
+ }
79
+ }
80
+ ],
81
+ title: [
82
+ -> { @attributes["title"]["_content"] },
83
+ ],
84
+ description: [
85
+ -> { @attributes["description"]["_content"] },
86
+ ],
87
+ owner: [
88
+ -> {
89
+ if @attributes["owner"].is_a?(String)
90
+ {
91
+ "nsid" => @attributes["owner"],
92
+ "username" => @attributes["ownername"] || @attributes["username"],
93
+ "iconserver" => @attributes["iconserver"],
94
+ "iconfarm" => @attributes["iconfarm"],
95
+ }
96
+ end
97
+ },
98
+ ],
99
+ path_alias: [
100
+ -> { @attributes["pathalias"] },
101
+ ],
102
+ location_visibility: [
103
+ -> { @attributes["geoperms"] },
104
+ -> {
105
+ {
106
+ "isfamily" => @attributes.fetch("geo_is_family"),
107
+ "isfriend" => @attributes.fetch("geo_is_friend"),
108
+ "iscontact" => @attributes.fetch("geo_is_contact"),
109
+ "ispublic" => @attributes.fetch("geo_is_public"),
110
+ }
111
+ }
112
+ ],
113
+ location: [
114
+ -> {
115
+ {
116
+ "latitude" => @attributes.fetch("latitude"),
117
+ "longitude" => @attributes.fetch("longitude"),
118
+ "accuracy" => @attributes["accuracy"],
119
+ "context" => @attributes["context"],
120
+ "place_id" => @attributes["place_id"],
121
+ "woeid" => @attributes["woeid"],
122
+ }
123
+ },
124
+ ],
125
+ available_sizes: [
126
+ -> {
127
+ sizes = Size.all.select do |size|
128
+ @attributes["url_#{size.abbreviation}"] or
129
+ @attributes["sizes"] && @attributes["sizes"]["size"].find { |h| h["label"] == size.label }
130
+ end
131
+
132
+ sizes.map(&:name)
133
+ },
134
+ ],
135
+ largest_size: [
136
+ -> { available_sizes.last },
137
+ ],
138
+ rotation: [
139
+ -> { @attributes["rotation"] },
140
+ ],
141
+ source_url: [
142
+ -> { @attributes["url_#{@size.abbreviation}"] },
143
+ -> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["source"] }
144
+ ],
145
+ height: [
146
+ -> { @attributes["height_#{@size.abbreviation}"] },
147
+ -> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["height"] }
148
+ ],
149
+ width: [
150
+ -> { @attributes["width_#{@size.abbreviation}"] },
151
+ -> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["width"] }
152
+ ],
153
+ url: [
154
+ -> { "http://www.flickr.com/photos/#{owner.id}/#{id}" if owner.id && id },
155
+ ],
156
+ short_url: [
157
+ -> { "http://flic.kr/p/#{BaseConverter.to_base58(id)}" if id },
158
+ ],
159
+ )
160
+
161
+ end
162
+
163
+ end
164
+ end
@@ -0,0 +1,53 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class Set
5
+
6
+ attributes.add_locations(
7
+ owner: [
8
+ -> {
9
+ if @attributes["owner"]
10
+ {
11
+ "id" => @attributes["owner"],
12
+ "username" => @attributes["username"],
13
+ }
14
+ end
15
+ },
16
+ ],
17
+ url: [
18
+ -> { "http://www.flickr.com/photos/#{owner.id}/sets/#{id}" },
19
+ ],
20
+ photos_count: [
21
+ -> { @attributes["photos"] },
22
+ -> { @attributes["count_photos"] },
23
+ ],
24
+ views_count: [
25
+ -> { @attributes["count_views"] },
26
+ ],
27
+ comments_count: [
28
+ -> { @attributes["count_comments"] },
29
+ ],
30
+ title: [
31
+ -> { @attributes["title"]["_content"] },
32
+ ],
33
+ description: [
34
+ -> { @attributes["description"]["_content"] },
35
+ ],
36
+ permissions: [
37
+ -> { {"can_comment" => @attributes["can_comment"]} },
38
+ ],
39
+ created_at: [
40
+ -> { @attributes["date_create"] },
41
+ ],
42
+ updated_at: [
43
+ -> { @attributes["date_update"] },
44
+ ],
45
+ primary_photo: [
46
+ -> { {"id" => @attributes.fetch("primary")} },
47
+ ],
48
+ )
49
+
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,30 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class UploadTicket
5
+
6
+ attributes.add_locations(
7
+ status: [
8
+ -> { @attributes["complete"] },
9
+ ],
10
+ complete: [
11
+ -> { status == 1 },
12
+ ],
13
+ failed: [
14
+ -> { status == 2 },
15
+ ],
16
+ invalid: [
17
+ -> { @attributes["invalid"] || 0},
18
+ ],
19
+ valid: [
20
+ -> { not invalid? },
21
+ ],
22
+ photo: [
23
+ -> { {"id" => @attributes.fetch("photoid")} },
24
+ ],
25
+ )
26
+
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class Visibility
5
+
6
+ attributes.add_locations(
7
+ public: [
8
+ -> { @attributes["ispublic"] },
9
+ ],
10
+ friends: [
11
+ -> { @attributes["isfriend"] },
12
+ ],
13
+ family: [
14
+ -> { @attributes["isfamily"] },
15
+ ],
16
+ contacts: [
17
+ -> { @attributes["iscontact"] },
18
+ ],
19
+ )
20
+
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ require "kaminari"
2
+ require "kaminari/models/array_extension"
3
+
4
+ module Flickr
5
+ class Object
6
+
7
+ class List < Kaminari::PaginatableArray
8
+
9
+ ##
10
+ # @private
11
+ #
12
+ def initialize(attributes)
13
+ raise ArgumentError, "attributes should not be nil" if attributes.nil?
14
+
15
+ @attributes = attributes
16
+ super([], offset: current_page, limit: per_page, total_count: total_entries)
17
+ end
18
+
19
+ ##
20
+ # @private
21
+ #
22
+ def populate(objects)
23
+ replace(objects)
24
+ self
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class List < Array
5
+
6
+ ##
7
+ # @private
8
+ #
9
+ def initialize(attributes)
10
+ raise ArgumentError, "attributes should not be nil" if attributes.nil?
11
+
12
+ @attributes = attributes
13
+ super()
14
+ end
15
+
16
+ ##
17
+ # @private
18
+ #
19
+ def populate(objects)
20
+ replace(objects)
21
+ self
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,31 @@
1
+ require "will_paginate/collection"
2
+
3
+ module Flickr
4
+ class Object
5
+
6
+ class List < WillPaginate::Collection
7
+
8
+ ##
9
+ # @private
10
+ #
11
+ def initialize(attributes)
12
+ raise ArgumentError, "attributes should not be nil" if attributes.nil?
13
+
14
+ @attributes = attributes
15
+ @attributes = {"page" => 1, "per_page" => 1, "total" => 1} if @attributes.empty?
16
+
17
+ super(current_page, per_page, total_entries)
18
+ end
19
+
20
+ ##
21
+ # @private
22
+ #
23
+ def populate(objects)
24
+ replace(objects)
25
+ self
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,87 @@
1
+ require "flickr/object/list/#{Flickr.pagination || "normal"}"
2
+ require "flickr/attributes"
3
+
4
+ module Flickr
5
+ class Object
6
+
7
+ ##
8
+ # Flickr offers pagination when returning collection responses, so this
9
+ # class encapsulates this data, and also provides useful finder methods,
10
+ # similar to ActiveRecord's.
11
+ #
12
+ class List
13
+
14
+ extend Flickr::Attributes
15
+
16
+ attribute :current_page, Integer
17
+ attribute :per_page, Integer
18
+ attribute :total_pages, Integer
19
+ attribute :total_entries, Integer
20
+
21
+ ##
22
+ # @see Flickr::Object#attributes
23
+ #
24
+ attr_reader :attributes
25
+
26
+ ##
27
+ # If block is given, does a regular Enumerable#find, otherwise finds by
28
+ # ID(s).
29
+ #
30
+ # @param id_or_ids [String, Array<String>] ID(s) of the object(s) to find.
31
+ # @return [Flickr::Object, Array<Flickr::Object>, nil]
32
+ #
33
+ def find(id_or_ids = nil)
34
+ return super if block_given?
35
+
36
+ if id_or_ids.is_a?(Enumerable)
37
+ id_or_ids.map { |id| find(id) }
38
+ else
39
+ find_by(id: id_or_ids.to_s)
40
+ end
41
+ end
42
+
43
+ ##
44
+ # Finds by a hash of attributes. Supports nesting (see the example).
45
+ #
46
+ # @param attributes [Hash] Attributes by which to search.
47
+ # @return [Flickr::Object, nil]
48
+ # @example
49
+ # photos.find_by(id: "1", owner: {username: "janko"})
50
+ #
51
+ def find_by(attributes)
52
+ find { |object| object.matches?(attributes) }
53
+ end
54
+
55
+ ##
56
+ # Filters by a hash of attributes. Supports nesting (see the example).
57
+ #
58
+ # @param attributes [Hash] Attributes by which to search
59
+ # @return [Array<Flickr::Object>]
60
+ # @example
61
+ # photos.filter(owner: {username: "janko"})
62
+ #
63
+ def filter(attributes)
64
+ select { |object| object.matches?(attributes) }
65
+ end
66
+
67
+ ##
68
+ # @deprecated It provides #find_by_<attribute> methods, but they are now
69
+ # deprecated in favor of the obviously superior {#find_by} (repeating
70
+ # ActiveRecord's mistake :P).
71
+ #
72
+ def method_missing(name, *args, &block)
73
+ if name.to_s =~ /find_by_\w+/
74
+ Flickr.deprecation_warn "#find_by_<attribute>(<value>) is deprecated; use #find_by(:<attribute> => <value>) instead"
75
+ attribute_name = name[/(?<=find_by_)\w+/]
76
+ find { |object| object.send(attribute_name) == args.first }
77
+ else
78
+ super
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ end
85
+ end
86
+
87
+ require_relative "attribute_locations/list"
@@ -0,0 +1,35 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class Location < Flickr::Object
5
+
6
+ class Area < Flickr::Object
7
+
8
+ attribute :name, String
9
+ attribute :place_id, String
10
+ attribute :woe_id, String
11
+
12
+ end
13
+
14
+ attribute :latitude, Float
15
+ attribute :longitude, Float
16
+ attribute :accuracy, Integer
17
+ attribute :context, Integer
18
+ attribute :place_id, String
19
+ attribute :woe_id, String
20
+
21
+ attribute :indoors, Boolean
22
+ attribute :outdoors, Boolean
23
+
24
+ attribute :neighbourhood, Area
25
+ attribute :locality, Area
26
+ attribute :county, Area
27
+ attribute :region, Area
28
+ attribute :country, Area
29
+
30
+ end
31
+
32
+ end
33
+ end
34
+
35
+ require_relative "attribute_locations/location"
@@ -0,0 +1,18 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class Permissions < Flickr::Object
5
+
6
+ attribute :can_comment, Boolean
7
+ attribute :can_add_meta, Boolean
8
+ attribute :can_download, Boolean
9
+ attribute :can_blog, Boolean
10
+ attribute :can_print, Boolean
11
+ attribute :can_share, Boolean
12
+
13
+ end
14
+
15
+ end
16
+ end
17
+
18
+ require_relative "attribute_locations/permissions"
@@ -0,0 +1,22 @@
1
+ module Flickr
2
+ class Object
3
+ class Person
4
+
5
+ class UploadStatus < Flickr::Object
6
+
7
+ class Month < Object
8
+ attribute :maximum, Integer
9
+ attribute :used, Integer
10
+ attribute :remaining, Integer
11
+ end
12
+
13
+ attribute :current_month, Month
14
+ attribute :maximum_photo_size, Integer
15
+
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+
22
+ require_relative "../attribute_locations/person/upload_status"
@@ -0,0 +1,93 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class Person < Flickr::Object
5
+
6
+ autoload_names :UploadStatus
7
+
8
+ attribute :id, String
9
+ attribute :nsid, String
10
+ attribute :username, String
11
+ attribute :real_name, String
12
+ attribute :location, String
13
+ attribute :time_zone, Hash
14
+ attribute :description, String
15
+ attribute :has_pro_account, Boolean
16
+
17
+ attribute :icon_server, Integer
18
+ attribute :icon_farm, Integer
19
+ attribute :buddy_icon_url, String
20
+
21
+ attribute :photos_url, String
22
+ attribute :profile_url, String
23
+ attribute :mobile_url, String
24
+
25
+ attribute :first_photo_taken, Time
26
+ attribute :first_photo_uploaded, Time
27
+ attribute :favorited_at, Time
28
+
29
+ attribute :photos_count, Integer
30
+ attribute :photo_views_count, Integer
31
+
32
+ attribute :path_alias, String
33
+
34
+ ##
35
+ # @return [self]
36
+ # @see Flickr::Api::Person#get_info
37
+ #
38
+ def get_info!(params = {})
39
+ person = api.get_info(id, params)
40
+ update(person.attributes)
41
+ end
42
+
43
+ ##
44
+ # @return [Flickr::Object::List<Flickr::Object::Photo>]
45
+ # @see Flickr::Api::Person#get_photos
46
+ #
47
+ def get_photos(params = {})
48
+ api.get_photos(id, params)
49
+ end
50
+ alias photos get_photos
51
+
52
+ ##
53
+ # @return [Flickr::Object::List<Flickr::Object::Photo>]
54
+ # @see Flickr::Api::Person#get_photos_of
55
+ #
56
+ def get_photos_of(params = {})
57
+ api.get_photos_of(id, params)
58
+ end
59
+ alias photos_of get_photos_of
60
+
61
+ ##
62
+ # @return [Flickr::Object::List<Flickr::Object::Photo>]
63
+ # @see Flickr::Api::Person#get_public_photos
64
+ #
65
+ def get_public_photos(params = {})
66
+ api.get_public_photos(id, params)
67
+ end
68
+ alias public_photos get_public_photos
69
+
70
+ ##
71
+ # @return [Flickr::Object::List<Flickr::Object::Photo>]
72
+ # @see Flickr::Api::Person#get_public_photos_from_contacts
73
+ #
74
+ def get_public_photos_from_contacts(params = {})
75
+ api.get_public_photos_from_contacts(id, params)
76
+ end
77
+ alias public_photos_from_contacts get_public_photos_from_contacts
78
+
79
+ ##
80
+ # @return [Flickr::Object::List<Flickr::Object::Set>]
81
+ # @see Flickr::Api::Person#get_sets
82
+ #
83
+ def get_sets(params = {})
84
+ api.get_sets(id, params)
85
+ end
86
+ alias sets get_sets
87
+
88
+ end
89
+
90
+ end
91
+ end
92
+
93
+ require_relative "attribute_locations/person"
@@ -0,0 +1,35 @@
1
+ module Flickr
2
+ class Object
3
+ class Photo
4
+
5
+ class Exif < Flickr::Object
6
+
7
+ class Item < Object
8
+ attribute :tagspace, String
9
+ attribute :tagspace_id, String
10
+ attribute :tag, String
11
+ attribute :label, String
12
+ attribute :raw, String
13
+ attribute :clean, String
14
+ end
15
+
16
+ attribute :items, List[Item]
17
+
18
+ ##
19
+ # Fetches the item with the given label and grabs the value.
20
+ #
21
+ # @param label [String] Label of the exif data
22
+ # @return [String]
23
+ #
24
+ def [](label)
25
+ item = items.find { |item| item.label == label }
26
+ item.clean || item.raw
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+ end
33
+ end
34
+
35
+ require_relative "../attribute_locations/photo/exif"
@@ -0,0 +1,20 @@
1
+ module Flickr
2
+ class Object
3
+ class Photo
4
+
5
+ class Note < Flickr::Object
6
+
7
+ attribute :id, String
8
+ attribute :author, Person
9
+ attribute :coordinates, Array[Integer]
10
+ attribute :width, Integer
11
+ attribute :height, Integer
12
+ attribute :content, String
13
+
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
20
+ require_relative "../attribute_locations/photo/note"