Module: TalentLMS
- Extended by:
- TalentLMS
- Included in:
- TalentLMS
- Defined in:
- lib/talentlms.rb,
lib/talentlms/client.rb,
lib/talentlms/api_error.rb
Defined Under Namespace
Classes: ApiError, Client
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
12
13
14
15
16
|
# File 'lib/talentlms.rb', line 12
def method_missing(method, *args, &block)
response = @@client.send(method, *args, &block)
raise ApiError.new(response) if error_response?(response)
response
end
|
Instance Method Details
#error_response?(response) ⇒ Boolean
18
19
20
|
# File 'lib/talentlms.rb', line 18
def error_response?(response)
response.is_a?(Hash) && response.key?("error")
end
|
#init(options = {}) ⇒ Object
8
9
10
|
# File 'lib/talentlms.rb', line 8
def init(options={})
@@client = Client.new(options)
end
|