wheniwork-ruby

WhenIWork - the Ruby gem for the Wheniwork

This SDK is automatically generated by the Swagger Codegen project:

  • API version: v2
  • Package version: 1.0.0
  • Build date: 2016-05-25T14:18:09.696-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.0.0.gem

(for development, run gem install --dev ./wheniwork-ruby-1.0.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.0.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::Api.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 Api->get_positions: #{e}"
end

Documentation for API Endpoints

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

Class Method HTTP request Description
WhenIWork::Api get_positions GET /positions
WhenIWork::Api get_shift GET /shifts/shift-id
WhenIWork::Api get_shifts GET /shifts
WhenIWork::Api get_user GET /users/user-id
WhenIWork::Api get_users GET /users

Documentation for Models

Documentation for Authorization

apiKey

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