mingle4r

github.com/arusarka/mingle4r/tree/master

DESCRIPTION:

This gem is a wrapper around active resource to access the rest api exposed by mingle. It provides a easy way to communicate with mingle. For the library to work you need to enable basic authentication (not enabled by default) in Mingle. See below to enable basic authentication in Mingle.

The speciality of this gem is that once an active resource class attribute (e.g- site, user, password, collection_name, element_name) is set, it cannot be changed. That is even if the attributes are changed it doesn’t get reflected in the ActiveResource::Base methods due to redefining the methods. The short story is that active resource fails to find the resources at the location and it throws an error. There are two ways to get around it.1) A small and effective hack (but a hack is hack!). The other way is to create the resource classes dynamically and set the attributes properly. This library uses the later approach. But it also provides a lot of other helper methods which makes interacting with Mingle a lot easier.

However if you are planning to connect and work with mingle from the terminal, then there is another gem mingle-mingle which you should look at. This library provides a very easy api to write code to work with mingle (see the examples below) but thats it.

Enable basic authentication in Mingle


1) Go to Mingle DataDir

2) Open YAML file <Mingle DataDir>/config/auth_config.yml

3) Set ‘basic_authentication_enabled’ to ‘true’ (without the quotes) if it is not so

FEATURES/PROBLEMS:

It gives you access to projects in the mingle instance, cards under the project and also attachments for a particular card. Presently comments on cards cannot be updated as mingle does not expose this api. It will be supported in later version only if mingle supports it.

SYNOPSIS:

A) Getting all the projects for a particular instance


Suppose you want to connect to the mingle instance hosted at localhost:8080 where the username is ‘testuser’ and password is ‘password’.

m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’) projs = m_c.projects

projs is an array of active resource objects

B) Getting a particular project


Before you access a particular project you need to set the project id for the mingle client object. You can do that in two ways. Supposing you are trying to access a project with an identifier of ‘great_mingle_project’

WARNING : project identifier and project name are different. If you named your project as ‘Great Mingle Project’ it’s identifier is by default ‘great_mingle_project’. To be sure what the identifier of a project is you should look at the url in mingle in the particular project you are trying to access. It should be something like ‘localhost:8080/projects/great_mingle_project

1) Set at initialize time

m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’, ‘great_mingle_project’) m_c.project

2) Set an attribute later

m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’) m_c.proj_id = ‘great_mingle_project’ m_c.project

C) Getting cards for a particular project


Get a mingle client object initialized as in SECTION B. Then call the cards method.

m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’) m_c.proj_id = ‘great_mingle_project’ m_c.cards

cards will be an array of activeresoure objects.

D) Getting custom properties for any resource


m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’) m_c.proj_id = ‘great_mingle_project’ card = m_c.cards card.custom_properties => returns an array of hashes, name => property method name

property name is the name as you see in mingle, whereas property method name is the name of the method that you need to call on the active resource object (card in this case). The default is for a property name ‘Added in Iteration Number’ the method to call is ‘added_in_iteration_number’ However this gives only custom properties, not all the properties.

E) Getting a particular property


gets a particular property value when the name of the property(as is displayed in Mingle) is given

m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’) m_c.proj_id = ‘great_mingle_project’ card = m_c.cards card.property_value(‘Status’)

F) Adding comment to a particular card


m_c = Mingle4r::MingleClient.new(‘localhost:8080’, ‘testuser’, ‘password’) m_c.proj_id = ‘great_mingle_project’ defect_card = m_c.cards defect_card.add_comment(‘Not able to reproduce’)

REQUIREMENTS:

1) active_resource gem, it would be automatically taken care of during gem install.

2) Mingle > 2.3

INSTALL:

sudo (not on crappy windows) gem install mingle4r

LICENSE:

(The MIT License)

Copyright © 2009 Arusarka Haldar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.