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
@@ -1,15 +0,0 @@
1
- class Flickr
2
- module Base58
3
- ALPHABET = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'.chars.to_a.freeze
4
-
5
- def to_base58(value)
6
- value = Integer(value)
7
- begin
8
- value, remainder = value.divmod(58)
9
- result = ALPHABET[remainder] + (result || '')
10
- end while value > 0
11
-
12
- result
13
- end
14
- end
15
- end
@@ -1,4 +0,0 @@
1
- class Flickr
2
- class Boolean
3
- end
4
- end
@@ -1,5 +0,0 @@
1
- class Hash
2
- def slice(*keys)
3
- select { |key, value| keys.include?(key) }
4
- end unless method_defined?(:slice)
5
- end
@@ -1,49 +0,0 @@
1
- require "date"
2
- require "flickr/helpers/boolean"
3
-
4
- class Flickr
5
- class Object
6
- class Attribute::Converter
7
- def initialize(instance)
8
- @instance = instance
9
- end
10
-
11
- def convert(value, type)
12
- return value if value.nil?
13
-
14
- if type.is_a?(Array)
15
- return value.map {|item| convert(item, type.first) }
16
- elsif Object.children.include?(type)
17
- return type.new(value, @instance.client)
18
- else
19
- try_each(CONVERTERS[type]) do |converter|
20
- return converter.call(value)
21
- end
22
- end
23
-
24
- value
25
- end
26
-
27
- CONVERTERS = {
28
- ::Object => [->(value) { value }],
29
- String => [->(value) { String(value) }],
30
- Time => [->(value) { Time.at(Integer(value)) }, ->(value) { DateTime.parse(value).to_time }],
31
- Boolean => [->(value) { Integer(value) == 1 }],
32
- Integer => [->(value) { Integer(value) }],
33
- Float => [->(value) { Float(value) }],
34
- Hash => [->(value) { value }],
35
- }
36
-
37
- private
38
-
39
- def try_each(enum, &block)
40
- enum.each do |element|
41
- begin
42
- yield element
43
- rescue
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,32 +0,0 @@
1
- class Flickr
2
- class Object
3
- class Attribute::Finder
4
- def initialize(instance)
5
- @instance = instance
6
- end
7
-
8
- def find(attribute)
9
- attribute_values = @instance.class.attribute_values[attribute] || []
10
- attribute_values << ->{ @hash.fetch(attribute.to_s) }
11
-
12
- try_each(attribute_values) do |attribute_value|
13
- result = @instance.instance_exec(&attribute_value)
14
- return result unless result.nil?
15
- end
16
-
17
- nil
18
- end
19
-
20
- private
21
-
22
- def try_each(enum, &block)
23
- enum.each do |element|
24
- begin
25
- yield element
26
- rescue
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,45 +0,0 @@
1
- class Flickr
2
- class Object
3
- module Attribute
4
- def self.extended(base)
5
- base.send(:include, InstanceMethods)
6
- end
7
-
8
- def attributes
9
- @attributes ||= []
10
- end
11
-
12
- def attribute(name, type = ::Object, options = {})
13
- attributes << name
14
-
15
- define_method(name) do
16
- retrieve_value(name, type)
17
- end
18
-
19
- Array(options[:aliases]).each do |alias_name|
20
- alias_method alias_name, name
21
- end
22
- end
23
-
24
- module InstanceMethods
25
- def attribute_finder
26
- Finder.new(self)
27
- end
28
-
29
- def attribute_converter
30
- Converter.new(self)
31
- end
32
-
33
- def retrieve_value(name, type)
34
- value = attribute_finder.find(name)
35
- attribute_converter.convert(value, type)
36
- end
37
- end
38
-
39
- attr_accessor :attribute_values
40
- end
41
- end
42
- end
43
-
44
- require_relative "attribute/finder"
45
- require_relative "attribute/converter"
@@ -1,10 +0,0 @@
1
- class Flickr
2
- class List
3
- self.attribute_values = {
4
- current_page: [->{ @hash["page"] }],
5
- per_page: [->{ @hash["per_page"] }, ->{ @hash["perpage"] }],
6
- total_entries: [->{ @hash["total"] }],
7
- total_pages: [->{ @hash["pages"] }],
8
- }
9
- end
10
- end
@@ -1,14 +0,0 @@
1
- class Flickr
2
- class Location < Object
3
- class Area < Object
4
- self.attribute_values = {
5
- name: [->{ @hash["_content"] }],
6
- woe_id: [->{ @hash["woeid"] }],
7
- }
8
- end
9
-
10
- self.attribute_values = {
11
- woe_id: [->{ @hash["woeid"] }],
12
- }
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- class Flickr
2
- class Note < Object
3
- self.attribute_values = {
4
- author: [->{ {"id" => @hash.fetch("author"), "username" => @hash["authorname"]} }],
5
- coordinates: [->{ [@hash.fetch("x"), @hash.fetch("y")] }],
6
- width: [->{ @hash["w"] }],
7
- height: [->{ @hash["h"] }],
8
- content: [->{ @hash["_content"] }],
9
- }
10
- end
11
- end
@@ -1,12 +0,0 @@
1
- class Flickr
2
- class Permissions < Object
3
- self.attribute_values = {
4
- can_comment?: [->{ @hash["cancomment"] }, ->{ @hash["can_comment"] }],
5
- can_add_meta?: [->{ @hash["canaddmeta"] }],
6
- can_download?: [->{ @hash["candownload"] }],
7
- can_blog?: [->{ @hash["canblog"] }],
8
- can_print?: [->{ @hash["canprint"] }],
9
- can_share?: [->{ @hash["canshare"] }],
10
- }
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- class Flickr
2
- class Person::UploadStatus < Object
3
- class Month < Object
4
- self.attribute_values = {
5
- maximum: [->{ @hash["maxkb"] / 1024 }],
6
- used: [->{ @hash["usedkb"] / 1024 }],
7
- remaining: [->{ @hash["remainingkb"] / 1024 }],
8
- }
9
- end
10
-
11
- self.attribute_values = {
12
- current_month: [->{ @hash["bandwidth"].slice("maxkb", "usedkb", "remainingkb") }],
13
- maximum_photo_size: [->{ @hash["filesize"]["maxmb"] }],
14
- }
15
- end
16
- end
@@ -1,24 +0,0 @@
1
- class Flickr
2
- class Person < Object
3
- self.attribute_values = {
4
- id: [->{ @hash["nsid"] }],
5
- nsid: [->{ id }],
6
- username: [->{ @hash["username"]["_content"] }],
7
- real_name: [->{ @hash["realname"] }, ->{ @hash["realname"]["_content"] }],
8
- icon_server: [->{ @hash["iconserver"] }],
9
- icon_farm: [->{ @hash["iconfarm"] }],
10
- has_pro_account?: [->{ @hash["ispro"] }],
11
- location: [->{ @hash["location"]["_content"] }],
12
- time_zone: [->{ @hash["timezone"] }],
13
- description: [->{ @hash["description"]["_content"] }],
14
- photos_url: [->{ @hash["photosurl"]["_content"] }],
15
- profile_url: [->{ @hash["profileurl"]["_content"] }],
16
- mobile_url: [->{ @hash["mobileurl"]["_content"] }],
17
- first_photo_taken: [->{ @hash["photos"]["firstdatetaken"]["_content"] }],
18
- first_photo_uploaded: [->{ @hash["photos"]["firstdate"]["_content"] }],
19
- favorited_at: [->{ @hash["favedate"] }],
20
- photos_count: [->{ @hash["photos"]["count"]["_content"] }],
21
- photo_views_count: [->{ @hash["photos"]["views"]["_content"] }],
22
- }
23
- end
24
- end
@@ -1,84 +0,0 @@
1
- class Flickr
2
- class Photo < Object
3
- self.attribute_values = {
4
- uploaded_at: [->{ @hash["dateuploaded"] }, ->{ @hash["dateupload"] }],
5
- favorite?: [->{ @hash["isfavorite"] }],
6
- posted_at: [->{ @hash["dates"]["posted"] }],
7
- taken_at: [->{ @hash["dates"]["taken"] }, ->{ @hash["datetaken"] }],
8
- taken_at_granularity: [->{ @hash["dates"]["takengranularity"] }, ->{ @hash["datetakengranularity"] }],
9
- updated_at: [->{ @hash["dates"]["lastupdate"] }, ->{ @hash["lastupdate"] }],
10
- views_count: [->{ @hash["views"] }],
11
- public_editability: [->{ @hash["publiceditability"] }],
12
- comments_count: [->{ @hash["comments"]["_content"] }],
13
- has_people?: [->{ @hash["people"]["haspeople"] }],
14
- notes: [->{ @hash["notes"]["note"] }],
15
- tags: [
16
- ->{ @hash["tags"]["tag"].map { |h| h.merge("photo_id" => @hash["id"]) } },
17
- ->{
18
- [
19
- *@hash["tags"].split(" ").map {|content| {"_content" => content, "machine_tag" => 0} },
20
- *@hash["machine_tags"].split(" ").map {|content| {"_content" => content, "machine_tag" => 1} }
21
- ]
22
- }
23
- ],
24
- visibility: [->{ @hash["visibility"] }, ->{ @hash.slice("ispublic", "isfriend", "isfamily") if @hash["ispublic"] }],
25
- title: [->{ @hash["title"]["_content"] }],
26
- description: [->{ @hash["description"]["_content"] }],
27
- owner: [
28
- ->{
29
- if @hash["owner"].is_a?(String)
30
- {
31
- "id" => @hash["owner"],
32
- "username" => @hash["ownername"] || @hash["username"],
33
- "iconserver" => @hash["iconserver"],
34
- "iconfarm" => @hash["iconfarm"],
35
- }
36
- end
37
- }
38
- ],
39
- path_alias: [->{ @hash["pathalias"] }],
40
- location_visibility: [
41
- ->{ @hash["geoperms"] },
42
- ->{
43
- {
44
- "isfamily" => @hash.fetch("geo_is_family"),
45
- "isfriend" => @hash.fetch("geo_is_friend"),
46
- "iscontact" => @hash.fetch("geo_is_contact"),
47
- "ispublic" => @hash.fetch("geo_is_public")
48
- }
49
- }
50
- ],
51
- location: [->{ @hash.slice("latitude", "longitude", "accuracy", "context", "place_id", "woeid") if @hash["latitude"] }],
52
- largest_size: [->{ SIZES.key(SIZES.values.reverse.find { |abbr| @hash["url_#{abbr}"] }) }],
53
- available_sizes: [->{ SIZES.select { |_, abbr| @hash["url_#{abbr}"] }.keys }],
54
- rotation: [->{ @hash["rotation"] }],
55
- source_url: [
56
- ->{ @hash["url_#{SIZES[size]}"] },
57
- ->{ @hash["size"].find { |hash| hash["label"] == OTHER_SIZES[size] }["source"] }
58
- ],
59
- height: [
60
- ->{ @hash["height_#{SIZES[size]}"] },
61
- ->{ @hash["size"].find { |hash| hash["label"] == OTHER_SIZES[size] }["height"] }
62
- ],
63
- width: [
64
- ->{ @hash["width_#{SIZES[size]}"] },
65
- ->{ @hash["size"].find { |hash| hash["label"] == OTHER_SIZES[size] }["width"] }
66
- ],
67
- }
68
-
69
- OTHER_SIZES = {
70
- "Square 75" => "Square",
71
- "Thumbnail" => "Thumbnail",
72
- "Square 150" => "Large Square",
73
- "Small 240" => "Small",
74
- "Small 320" => "Small 320",
75
- "Medium 500" => "Medium",
76
- "Medium 640" => "Medium 640",
77
- "Medium 800" => "Medium 800",
78
- "Large 1024" => "Large",
79
- "Large 1600" => "Large 1600",
80
- "Large 2048" => "Large 2048",
81
- "Original" => "Original"
82
- }
83
- end
84
- end
@@ -1,17 +0,0 @@
1
- class Flickr
2
- class Set < Object
3
- self.attribute_values = {
4
- owner: [-> { {"id" => @hash.fetch("owner"), "username" => @hash["username"]} }],
5
- url: [-> { "http://www.flickr.com/photos/#{owner.id}/sets/#{id}/" }],
6
- photos_count: [-> { @hash["photos"] }, -> { @hash["count_photos"] }],
7
- views_count: [-> { @hash["count_views"] }],
8
- comments_count: [-> { @hash["count_comments"] }],
9
- title: [-> { @hash["title"]["_content"] }],
10
- description: [-> { @hash["description"]["_content"] }],
11
- permissions: [-> { @hash.slice("can_comment") }],
12
- created_at: [-> { @hash["date_create"] }],
13
- updated_at: [-> { @hash["date_update"] }],
14
- primary_photo: [-> { {"id" => @hash.fetch("primary")} }],
15
- }
16
- end
17
- end
@@ -1,9 +0,0 @@
1
- class Flickr
2
- class Tag < Object
3
- self.attribute_values = {
4
- author: [->{ {"id" => @hash.fetch("author")} }],
5
- content: [->{ @hash["_content"] }],
6
- machine_tag?: [->{ @hash["machine_tag"] }],
7
- }
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- class Flickr
2
- class UploadTicket < Object
3
- self.attribute_values = {
4
- status: [->{ @hash["complete"] }],
5
- invalid: [->{ @hash["invalid"] || 0}],
6
- photo: [->{ {"id" => @hash.fetch("photoid")} }],
7
- }
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- class Flickr
2
- class Visibility < Object
3
- self.attribute_values = {
4
- public?: [->{ @hash["ispublic"] }],
5
- friends?: [->{ @hash["isfriend"] }],
6
- family?: [->{ @hash["isfamily"] }],
7
- contacts?: [->{ @hash["iscontact"] }],
8
- }
9
- end
10
- end
@@ -1,86 +0,0 @@
1
- class Flickr
2
- case Flickr.configuration.pagination
3
- when nil
4
-
5
- class List < Array
6
- extend Flickr::Object::Attribute
7
-
8
- attribute :current_page, Integer
9
- attribute :per_page, Integer
10
- attribute :total_pages, Integer
11
- attribute :total_entries, Integer
12
-
13
- def initialize(objects, hash)
14
- @hash = hash
15
- super(objects)
16
- end
17
- end
18
-
19
- when :will_paginate
20
-
21
- require "will_paginate/collection"
22
-
23
- class List < WillPaginate::Collection
24
- extend Flickr::Object::Attribute
25
-
26
- def initialize(objects, hash)
27
- @hash = hash
28
- super(
29
- retrieve_value(:current_page, Integer),
30
- retrieve_value(:per_page, Integer),
31
- retrieve_value(:total_entries, Integer)
32
- )
33
- replace(objects)
34
- end
35
- end
36
-
37
- when :kaminari
38
-
39
- require "kaminari"
40
- require "kaminari/models/array_extension"
41
-
42
- class List < Kaminari::PaginatableArray
43
- extend Flickr::Object::Attribute
44
-
45
- def initialize(objects, hash)
46
- @hash = hash
47
- super(objects,
48
- offset: retrieve_value(:current_page, Integer),
49
- limit: retrieve_value(:per_page, Integer),
50
- total_count: retrieve_value(:total_entries, Integer)
51
- )
52
- end
53
- end
54
-
55
- else
56
- raise Error, "supported paginations are :will_paginate or :kaminari (you put \":#{Flickr.configuration.pagination}\")"
57
- end
58
- end
59
-
60
- require_relative "attribute_values/list"
61
-
62
- class Flickr
63
- class List
64
- def find(id = nil)
65
- if block_given?
66
- super
67
- else
68
- if id.is_a?(Array)
69
- ids = id.map(&:to_s)
70
- select { |object| ids.include?(object.id) }
71
- else
72
- super() { |object| object.id == id.to_s }
73
- end
74
- end
75
- end
76
-
77
- def method_missing(name, *args, &block)
78
- if name.to_s =~ /find_by_\w+/
79
- attribute_name = name[/(?<=find_by_)\w+/]
80
- find { |object| object.send(attribute_name) == args.first }
81
- else
82
- super
83
- end
84
- end
85
- end
86
- end
@@ -1,26 +0,0 @@
1
- require_relative "attribute_values/location"
2
-
3
- class Flickr
4
- class Location < Object
5
-
6
- class Area < Object
7
- attribute :name, String
8
- attribute :place_id, String
9
- attribute :woe_id, String
10
- end
11
-
12
- attribute :latitude, Float
13
- attribute :longitude, Float
14
- attribute :accuracy, Integer
15
- attribute :context, Integer
16
- attribute :place_id, String
17
- attribute :woe_id, String
18
-
19
- attribute :neighbourhood, Area
20
- attribute :locality, Area
21
- attribute :county, Area
22
- attribute :region, Area
23
- attribute :country, Area
24
-
25
- end
26
- end
@@ -1,14 +0,0 @@
1
- require_relative "attribute_values/note"
2
-
3
- class Flickr
4
- class Note < Object
5
-
6
- attribute :id, String
7
- attribute :author, Person
8
- attribute :coordinates, Array[Integer]
9
- attribute :width, Integer
10
- attribute :height, Integer
11
- attribute :content, String
12
-
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- require_relative "attribute_values/permissions"
2
-
3
- class Flickr
4
- class Permissions < 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
- end
@@ -1,14 +0,0 @@
1
- require_relative "../attribute_values/person/upload_status"
2
-
3
- class Flickr
4
- class Person::UploadStatus < Object
5
- class Month < Object
6
- attribute :maximum, Integer
7
- attribute :used, Integer
8
- attribute :remaining, Integer
9
- end
10
-
11
- attribute :current_month, Month
12
- attribute :maximum_photo_size, Integer
13
- end
14
- end
@@ -1,43 +0,0 @@
1
- require_relative "attribute_values/person"
2
- require "flickr/api/person"
3
-
4
- class Flickr
5
- class Person < Object
6
-
7
- attribute :id, String
8
- attribute :nsid, String
9
- attribute :username, String
10
- attribute :real_name, String
11
- attribute :location, String
12
- attribute :time_zone, Hash
13
- attribute :description, String
14
- attribute :has_pro_account?, Boolean
15
-
16
- attribute :icon_server, Integer
17
- attribute :icon_farm, Integer
18
-
19
- attribute :photos_url, String
20
- attribute :profile_url, String
21
- attribute :mobile_url, String
22
-
23
- attribute :first_photo_taken, Time
24
- attribute :first_photo_uploaded, Time
25
- attribute :favorited_at, Time
26
-
27
- attribute :photos_count, Integer
28
- attribute :photo_views_count, Integer
29
-
30
- attribute :path_alias, String
31
-
32
- def buddy_icon_url
33
- if icon_farm && icon_server && id
34
- if icon_server > 0
35
- "http://farm#{icon_farm}.staticflickr.com/#{icon_server}/buddyicons/#{id}.jpg"
36
- else
37
- "http://www.flickr.com/images/buddyicon.jpg"
38
- end
39
- end
40
- end
41
-
42
- end
43
- end