Class: Bloc::Client::Course

Inherits:
Object
  • Object
show all
Defined in:
lib/bloc/client/course.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ 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(options={})
  response = RestClient.get "http://www.trybloc.com/api/v1/courses/find", :params => options.merge(:api_key => Bloc::Client.credentials["api_key"])
  self.new JSON.parse(response.body)
end