Module: Imgur::Collection
- Included in:
- Imgur::Client::Accounts, Imgur::Client::Albums, Imgur::Client::BasicResponses, Imgur::Client::Images
- Defined in:
- lib/imgur/collection.rb
Defined Under Namespace
Modules: Attributes
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
2 3 4 |
# File 'lib/imgur/collection.rb', line 2 def self.included(klass) klass.send(:extend, Imgur::Collection::Attributes) end |
Instance Method Details
#get(id) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/imgur/collection.rb', line 24 def get(id) if data = connection.send(self.model_request, {"id" => id}).body[self.model_root] new(data) else nil end rescue Imgur::Response::NotFound nil end |
#model_request ⇒ Object
20 21 22 |
# File 'lib/imgur/collection.rb', line 20 def model_request self.class.instance_variable_get(:@model_request) end |
#model_root ⇒ Object
16 17 18 |
# File 'lib/imgur/collection.rb', line 16 def model_root self.class.instance_variable_get(:@model_root) end |