flickr-objects 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/flickr/object/attribute_locations/photo.rb +18 -4
- data/lib/flickr/object/photo/size.rb +26 -5
- data/lib/flickr/object/photo.rb +1 -5
- data/lib/flickr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 442add3120c6a46defe96432d84a7ec496a2e574
|
4
|
+
data.tar.gz: 8fddbf4731a2871b8427669bc85a235328f91b67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e23ac266dc1d3d2cf6155433a24e5a46bc7c7ebdde2f010bad05b41a2e410ccc8bab1fe7ca200facfdb6750e2603b9945c4b0eb3c1bb4d5efd7881b6233262e
|
7
|
+
data.tar.gz: 8f72874f1ace3b9ba50b827b0cba0516f8a0cc78429db37838ae1d0208be65e45ad2150c516ae081e6049739b824ddb6ae427a70678c69a97067ca05f6686dbe
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@ This gem is an object-oriented wrapper for the [Flickr API](http://flickr.com/ap
|
|
6
6
|
- Source code: [https://github.com/janko-m/flickr-objects](https://github.com/janko-m/flickr-objects)
|
7
7
|
- API Documentation: [http://rubydoc.info/github/janko-m/flickr-objects/master/frames](http://rubydoc.info/github/janko-m/flickr-objects/master/frames)
|
8
8
|
|
9
|
+
The gem has been tested on the following Ruby versions:
|
10
|
+
|
11
|
+
- MRI 1.9.3
|
12
|
+
- MRI 2.0
|
13
|
+
- MRI 2.1
|
14
|
+
|
9
15
|
## Installation and setup
|
10
16
|
|
11
17
|
Add it to your `Gemfile`, and run `bundle install`.
|
@@ -129,7 +129,7 @@ module Flickr
|
|
129
129
|
@attributes["sizes"] && @attributes["sizes"]["size"].find { |h| h["label"] == size.label }
|
130
130
|
end
|
131
131
|
|
132
|
-
sizes.map(&:name)
|
132
|
+
SIZES.first(9) | sizes.map(&:name) | ["Original"]
|
133
133
|
},
|
134
134
|
],
|
135
135
|
largest_size: [
|
@@ -140,15 +140,29 @@ module Flickr
|
|
140
140
|
],
|
141
141
|
source_url: [
|
142
142
|
-> { @attributes["url_#{@size.abbreviation}"] },
|
143
|
-
-> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["source"] }
|
143
|
+
-> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["source"] },
|
144
|
+
-> {
|
145
|
+
if @size.between?(Size.new("Square 75"), Size.new("Large 1024"))
|
146
|
+
url = "https://farm#{farm}.staticflickr.com/#{server}/#{id}_#{secret}"
|
147
|
+
url << "_#{@size.other_abbreviation}" if @size.other_abbreviation =~ /\w/
|
148
|
+
url << ".jpg"
|
149
|
+
url
|
150
|
+
elsif @size == Size.new("Original")
|
151
|
+
url = "https://farm#{farm}.staticflickr.com/#{server}/#{id}"
|
152
|
+
url << "_#{@attributes.fetch("originalsecret")}"
|
153
|
+
url << "_o"
|
154
|
+
url << ".#{@attributes.fetch("originalformat")}"
|
155
|
+
url
|
156
|
+
end
|
157
|
+
},
|
144
158
|
],
|
145
159
|
height: [
|
146
160
|
-> { @attributes["height_#{@size.abbreviation}"] },
|
147
|
-
-> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["height"] }
|
161
|
+
-> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["height"] },
|
148
162
|
],
|
149
163
|
width: [
|
150
164
|
-> { @attributes["width_#{@size.abbreviation}"] },
|
151
|
-
-> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["width"] }
|
165
|
+
-> { @attributes["sizes"]["size"].find { |hash| hash["label"] == @size.label }["width"] },
|
152
166
|
],
|
153
167
|
url: [
|
154
168
|
-> { "http://www.flickr.com/photos/#{owner.id}/#{id}" if owner.id && id },
|
@@ -19,6 +19,10 @@ module Flickr
|
|
19
19
|
# Used by Flickr for hash key names.
|
20
20
|
#
|
21
21
|
ABBREVIATIONS = %w[sq t q s n m z c l h k o]
|
22
|
+
##
|
23
|
+
# Used by Flickr for generating source URLs.
|
24
|
+
#
|
25
|
+
OTHER_ABBREVIATIONS = %w[s t q m n - z c b]
|
22
26
|
|
23
27
|
##
|
24
28
|
# Used by Flickr in response from "flickr.photos.getSizes".
|
@@ -43,13 +47,30 @@ module Flickr
|
|
43
47
|
all.include? new(name)
|
44
48
|
end
|
45
49
|
|
46
|
-
attr_reader :name
|
50
|
+
attr_reader :name
|
47
51
|
|
48
52
|
def initialize(name)
|
49
|
-
@name
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
@name = name
|
54
|
+
end
|
55
|
+
|
56
|
+
def type
|
57
|
+
name.split[0]
|
58
|
+
end
|
59
|
+
|
60
|
+
def number
|
61
|
+
name.split[1]
|
62
|
+
end
|
63
|
+
|
64
|
+
def abbreviation
|
65
|
+
ABBREVIATIONS[NAMES.index(name)]
|
66
|
+
end
|
67
|
+
|
68
|
+
def other_abbreviation
|
69
|
+
OTHER_ABBREVIATIONS[NAMES.index(name)]
|
70
|
+
end
|
71
|
+
|
72
|
+
def label
|
73
|
+
LABELS[NAMES.index(name)]
|
53
74
|
end
|
54
75
|
|
55
76
|
##
|
data/lib/flickr/object/photo.rb
CHANGED
data/lib/flickr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickr-objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|