Class: Bloc::Client::Course
- Inherits:
-
Object
- Object
- Bloc::Client::Course
- Defined in:
- lib/bloc/client/course.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Course
constructor
A new instance of Course.
- #method_missing(method) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Course
Returns a new instance of Course.
9 10 11 |
# File 'lib/bloc/client/course.rb', line 9 def initialize(attributes) @attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/bloc/client/course.rb', line 13 def method_missing(method) method = method.to_s if @attributes[method] return @attributes[method] else super(method) end end |
Class Method Details
.find(options = {}) ⇒ Object
4 5 6 7 |
# File 'lib/bloc/client/course.rb', line 4 def self.find(={}) response = RestClient.get "http://www.trybloc.com/api/v1/courses/find", :params => .merge(:api_key => Bloc::Client.credentials["api_key"]) self.new JSON.parse(response.body) end |