class Quake::Timesheets::EntriesApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/quake_timesheets_client/api/entries_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_entries(opts = {}) click to toggle source

Create a new Entry @param [Hash] opts the optional parameters @option opts [CreateEntriesInput] :create_entries_input @return [Entry]

# File lib/quake_timesheets_client/api/entries_api.rb, line 26
def create_entries(opts = {})
  data, _status_code, _headers = create_entries_with_http_info(opts)
  data
end
create_entries_with_http_info(opts = {}) click to toggle source

Create a new Entry @param [Hash] opts the optional parameters @option opts [CreateEntriesInput] :create_entries_input @return [Array<(Entry, Integer, Hash)>] Entry data, response status code and response headers

# File lib/quake_timesheets_client/api/entries_api.rb, line 35
def create_entries_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EntriesApi.create_entries ...'
  end
  # resource path
  local_var_path = '/api/v1/entries'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_entries_input'] || opts[:body])

  # return_type
  return_type = opts[:debug_return_type] || 'Entry'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['authToken']

  new_options = opts.merge(
    :operation => :"EntriesApi.create_entries",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EntriesApi#create_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
index_entries(opts = {}) click to toggle source

Search for entries matching filters @param [Hash] opts the optional parameters @option opts [String] :dataset_id Filter to the entries belonging to one of the identified datasets @option opts [String] :person_id Filter to the entries belonging to one of the identified people @option opts [String] :from_date Return only entries after this DateTime (inclusive) @option opts [String] :to_date Return only entries before this DateTime (inclusive) @return [Array<Entry>]

# File lib/quake_timesheets_client/api/entries_api.rb, line 88
def index_entries(opts = {})
  data, _status_code, _headers = index_entries_with_http_info(opts)
  data
end
index_entries_with_http_info(opts = {}) click to toggle source

Search for entries matching filters @param [Hash] opts the optional parameters @option opts [String] :dataset_id Filter to the entries belonging to one of the identified datasets @option opts [String] :person_id Filter to the entries belonging to one of the identified people @option opts [String] :from_date Return only entries after this DateTime (inclusive) @option opts [String] :to_date Return only entries before this DateTime (inclusive) @return [Array<(Array<Entry>, Integer, Hash)>] Array<Entry> data, response status code and response headers

# File lib/quake_timesheets_client/api/entries_api.rb, line 100
def index_entries_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EntriesApi.index_entries ...'
  end
  # resource path
  local_var_path = '/api/v1/entries'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?
  query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  query_params[:'from_date'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'to_date'] = opts[:'to_date'] if !opts[:'to_date'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Entry>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['authToken']

  new_options = opts.merge(
    :operation => :"EntriesApi.index_entries",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EntriesApi#index_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_entries(id, opts = {}) click to toggle source

Update an existing Entry @param id [String] The ID for the Entry @param [Hash] opts the optional parameters @option opts [UpdateEntriesInput] :update_entries_input @return [Entry]

# File lib/quake_timesheets_client/api/entries_api.rb, line 153
def update_entries(id, opts = {})
  data, _status_code, _headers = update_entries_with_http_info(id, opts)
  data
end
update_entries_with_http_info(id, opts = {}) click to toggle source

Update an existing Entry @param id [String] The ID for the Entry @param [Hash] opts the optional parameters @option opts [UpdateEntriesInput] :update_entries_input @return [Array<(Entry, Integer, Hash)>] Entry data, response status code and response headers

# File lib/quake_timesheets_client/api/entries_api.rb, line 163
def update_entries_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EntriesApi.update_entries ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EntriesApi.update_entries"
  end
  # resource path
  local_var_path = '/api/v1/entries/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_entries_input'] || opts[:body])

  # return_type
  return_type = opts[:debug_return_type] || 'Entry'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['authToken']

  new_options = opts.merge(
    :operation => :"EntriesApi.update_entries",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EntriesApi#update_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end