Coder Social home page Coder Social logo

fortytools / mite-rb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yolk/mite-rb

0.0 3.0 1.0 60 KB

The official ruby library for interacting with the RESTful mite.api.

Home Page: http://mite.yo.lk/en/api

License: MIT License

Ruby 100.00%

mite-rb's Introduction

mite-rb

The official ruby library for interacting with the RESTful API of mite, a sleek time tracking webapp.

Install

Install the lib as a ruby gem:

gem install mite-rb

mite-rb requires activeresource and activesupport in version 3.1 or above. If you want/need to use it with activeresource 2.3.14 to 3.0.9 please use mite-rb 0.4.5.

Documentation

You should read the complete mite.api documentation at http://mite.yo.lk/en/api

Authenticate

IMPORTANT: To use mite-rb you must enable the mite.api for your user within the webinterface of mite! It is disabled by default.

The first thing you need to set is the account name. This is the same as the web address (subdomain) for your account. For example if you use mite from the domain demo.mite.yo.lk set the account to 'demo':

Mite.account = 'demo'

Then, you should set the authentication. You can either use your mite.api key (recommended) or your login credentials (email and password).

Mite.key = 'cdfeasdaabcdefgssaeabcdefg'

or

Mite.authenticate('[email protected]', 'spacemonkey')

User-Agent

mite-rb sets the User-Agent HTTP-header to 'mite-rb/0.3.0' by default. You can (and should) customize it to a more specific one:

Mite.user_agent = 'my-mighty-mite-addon/1.2.3'

You can combine your custom string with the default one:

Mite.user_agent = "my-mighty-mite-addon/1.2.3;#{Mite.user_agent}"

Validate connection

You can validate the connection/authentication with

Mite.validate

This will return true when the connection is valid and false if not.

Use

Mite.validate!

and mite-rb will raise an exception with further details when the connection is not valid.

Project

Find all active projects

Mite::Project.all

Find all archived projects

Mite::Project.archived

Find projects where name contains 'web'

Mite::Project.all(:params => {:name => 'web'})

Find single project by ID

Mite::Project.find(1209)

Get all time entries of a project

project = Mite::Project.find(1209)
project.time_entries

Get the customer of a project

project = Mite::Project.find(1209)
project.customer

Creating

project = Mite::Project.new(:name => 'Playing with the mite.api')
project.save

or in a single step

project = Mite::Project.create(:name => 'Playing with the mite.api')

Updating

project = Mite::Project.find(1209)
project.name = "mite.api"
project.customer = Mite::Customer.find(384)
project.save

Deleting

project = Mite::Project.find(1209)
project.destroy

mite-rb's People

Contributors

yolk avatar sega avatar axelerator avatar janxious avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

arpadlukacs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.