Module: FlickRaw
- Defined in:
- lib/flickraw.rb
Defined Under Namespace
Modules: SimpleOStruct Classes: FailedResponse, Flickr, Request, Response
Constant Summary collapse
- VERSION =
'0.6'
- FLICKR_HOST =
'api.flickr.com'.freeze
- REST_PATH =
Path of flickr REST API
'/services/rest/?'.freeze
- AUTH_PATH =
Path of flickr auth page
'/services/auth/?'.freeze
- UPLOAD_PATH =
Path of flickr upload
'/services/upload/'.freeze
Class Attribute Summary collapse
-
.api_key ⇒ Object
Your flickr API key, see www.flickr.com/services/api/keys for more information.
-
.shared_secret ⇒ Object
The shared secret of api_key, see www.flickr.com/services/api/keys for more information.
Class Method Summary collapse
-
.api_sig(hsh) ⇒ Object
Returns the signature of hsh.
-
.auth_url(args = {}) ⇒ Object
Returns the flickr auth URL.
Class Attribute Details
.api_key ⇒ Object
Your flickr API key, see www.flickr.com/services/api/keys for more information
217 218 219 |
# File 'lib/flickraw.rb', line 217 def api_key @api_key end |
.shared_secret ⇒ Object
The shared secret of api_key, see www.flickr.com/services/api/keys for more information
220 221 222 |
# File 'lib/flickraw.rb', line 220 def shared_secret @shared_secret end |
Class Method Details
.api_sig(hsh) ⇒ Object
Returns the signature of hsh. This is meant to be passed in the api_sig parameter.
232 233 234 |
# File 'lib/flickraw.rb', line 232 def api_sig(hsh) MD5.md5(FlickRaw.shared_secret + hsh.sort{|a, b| a[0].to_s <=> b[0].to_s }.flatten.join).to_s end |
.auth_url(args = {}) ⇒ Object
Returns the flickr auth URL.
223 224 225 226 227 228 229 |
# File 'lib/flickraw.rb', line 223 def auth_url(args={}) full_args = {:api_key => FlickRaw.api_key, :perms => 'read'} args.each {|k, v| full_args[k.to_sym] = v } full_args[:api_sig] = api_sig(full_args) if FlickRaw.shared_secret 'http://' + FLICKR_HOST + AUTH_PATH + full_args.collect { |a, v| "#{a}=#{v}" }.join('&') end |