Module: TimestampAPI

Defined in:
lib/timestamp_api.rb,
lib/timestamp_api/model.rb,
lib/timestamp_api/utils.rb,
lib/timestamp_api/errors.rb,
lib/timestamp_api/version.rb,
lib/timestamp_api/collection.rb,
lib/timestamp_api/models/client.rb,
lib/timestamp_api/model_registry.rb,
lib/timestamp_api/models/project.rb,
lib/timestamp_api/model_relations.rb,
lib/timestamp_api/model_attributes.rb,
lib/timestamp_api/model_default_api_methods.rb

Defined Under Namespace

Modules: ModelAttributes, ModelDefaultAPIMethods, ModelRelations, Utils Classes: APIPathNotSet, Client, Collection, InvalidAPIKey, InvalidModelData, InvalidServerResponse, InvalidWhereContitions, MissingAPIKey, Model, ModelRegistry, Project, ResourceNotFound, UnknownAssociation, UnknownModelData

Constant Summary collapse

VERSION =
"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_endpointObject

Returns the value of attribute api_endpoint.



21
22
23
# File 'lib/timestamp_api.rb', line 21

def api_endpoint
  @api_endpoint
end

.api_keyObject

Returns the value of attribute api_key.



21
22
23
# File 'lib/timestamp_api.rb', line 21

def api_key
  @api_key
end

.verboseObject

Returns the value of attribute verbose.



21
22
23
# File 'lib/timestamp_api.rb', line 21

def verbose
  @verbose
end

Class Method Details

.request(method, path, query_params = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/timestamp_api.rb', line 24

def self.request(method, path, query_params = {})
  output(method, path, query_params) if verbose
  response = RestClient::Request.execute(request_options(method, path, query_params))
  modelify(JSON.parse(response))
rescue RestClient::Forbidden
  raise InvalidAPIKey
rescue JSON::ParserError
  raise InvalidServerResponse
end