Class: Camper::Client
- Inherits:
-
Object
- Object
- Camper::Client
- Includes:
- Calendars, Events, People, Projects, Connection
- Defined in:
- lib/camper/client.rb,
lib/camper/client/people.rb,
lib/camper/client/events.rb,
lib/camper/client/projects.rb,
lib/camper/client/calendars.rb
Defined Under Namespace
Modules: Calendars, Events, People, Projects
Constant Summary
Constant Summary
Constants included from Connection
Camper::Connection::DEFAULT_HEADERS
Instance Attribute Summary
Attributes included from Connection
#id, #password, #token, #token_secret, #username
Instance Method Summary (collapse)
-
- (Class, ...) handle(klass, response)
Handles a Faraday response with APIObject creation.
Methods included from Projects
#archived_projects, #create_project!, #project, #projects
Methods included from People
Methods included from Events
Methods included from Calendars
#calendar, #calendars, #create_calendar!
Methods included from Connection
#api_url, #connection, #delete, #get, #post, #put, #setup, #status
Instance Method Details
- (Class, ...) handle(klass, response)
Handles a Faraday response with APIObject creation
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/camper/client.rb', line 21 def handle(klass, response) if response.success? if response.body.is_a? Hash output = klass.new(self, response.body) elsif response.body.is_a? Array output = [] response.body.each do |item| output << klass.new(self, item) end end output else false end end |