/wheniwork-ruby

Ruby client for the wheniwork.com api

Primary LanguageRubyApache License 2.0Apache-2.0

wheniwork-ruby

WhenIWork - the Ruby gem for the Wheniwork

No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

This SDK is automatically generated by the Swagger Codegen project:

  • API version: v2
  • Package version: 1.2.0
  • Build date: 2016-09-27T12:59:03.293-04:00
  • Build package: class io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build wheniwork-ruby.gemspec

Then either install the gem locally:

gem install ./wheniwork-ruby-1.2.0.gem

(for development, run gem install --dev ./wheniwork-ruby-1.2.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'wheniwork-ruby', '~> 1.2.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'wheniwork-ruby', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'wheniwork-ruby'

# Setup authorization
WhenIWork.configure do |config|
  # Configure API key authorization: apiKey
  config.api_key['W-Token'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['W-Token'] = 'Bearer'
end

api_instance = WhenIWork::DefaultApi.new

opts = { 
  show_deleted: true # BOOLEAN | Whether to show positions that have been deleted.
}

begin
  result = api_instance.get_positions(opts)
  p result
rescue WhenIWork::ApiError => e
  puts "Exception when calling DefaultApi->get_positions: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api.wheniwork.com/2

Class Method HTTP request Description
WhenIWork::DefaultApi get_positions GET /positions
WhenIWork::DefaultApi get_shift GET /shifts/{shift-id}
WhenIWork::DefaultApi get_shifts GET /shifts
WhenIWork::DefaultApi get_times GET /times
WhenIWork::DefaultApi get_user GET /users/{user-id}
WhenIWork::DefaultApi get_users GET /users

Documentation for Models

Documentation for Authorization

apiKey

  • Type: API key
  • API key parameter name: W-Token
  • Location: HTTP header