Class: Flickr
- Inherits:
-
Object
- Object
- Flickr
- Defined in:
- lib/flickrrb.rb
Defined Under Namespace
Classes: Base, FlickrClient, FlickrMethod, Group, OAuthCient, Person, Photo, Size
Instance Method Summary collapse
-
#initialize(option = {}) ⇒ Flickr
constructor
api_key, debug = false.
Constructor Details
#initialize(option = {}) ⇒ Flickr
api_key, debug = false
11 12 13 14 15 16 17 |
# File 'lib/flickrrb.rb', line 11 def initialize option = {} #api_key, debug = false @debug = option[:debug] @flickr_client = FlickrClient.new option[:http], @debug @api_key = option[:api_key] @method = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/flickrrb.rb', line 21 def method_missing name, *args unless args.empty? || args.first.class == Hash @method.clear fail APIException, "Args must be a hash" end m = FlickrMethod.new(name, args.first) @method << m unless args.empty? p @method if @debug begin # FIXME command = build_command @method.clear @flickr_client.request(command) rescue @method.clear raise end else self end end |