Class: Coursera::Client
- Inherits:
-
Base
- Object
- Base
- Coursera::Client
show all
- Defined in:
- lib/coursera/client.rb
Instance Method Summary
collapse
Methods inherited from Base
batch_request, get_elements, prepare_attributes
Constructor Details
#initialize(options = {}) ⇒ Client
> client = Coursera::Client.new
8
9
10
|
# File 'lib/coursera/client.rb', line 8
def initialize(options = {})
@options = options
end
|
Instance Method Details
#find_course(id, attrs = {}) ⇒ Object
12
13
14
|
# File 'lib/coursera/client.rb', line 12
def find_course(id, attrs = {})
Coursera::Course.find id, attrs
end
|
#search_courses(query, attrs = {}) ⇒ Object
> client.search_courses(“data analytics”, { fields: [:name, :photo] })
17
18
19
20
|
# File 'lib/coursera/client.rb', line 17
def search_courses(query, attrs = {})
attrs = self.class.prepare_attributes(attrs)
Coursera::Course.batch_request("/courses.v1?q=search", { query: query}.merge(attrs))
end
|