masteryconnect

Functional wrapper for the MasteryConnect RESTful API.

npm install masteryconnect
12 downloads in the last week
22 downloads in the last month

masteryconnect.js Build Status Coverage Status

Functional wrapper for the MasteryConnect RESTful API. All publicly available MasteryConnect RESTful API functions are supported. The project makes heavy use of bilby.js and Q. You will likely need a familiarity with basic functional programming concepts and promises to be successful.

Depending

The project is available on the Node Packaged Modules registry. Add the dependency in your package.json file:

"dependencies": {
    "masteryconnect": "0.6.x"
}

Building

npm install
grunt

Using

CoffeeScript:

Setup context:

context = masteryconnect.Context
    .property('host', 'oauth.staging.masteryconnect.com')
    .property('oauthConsumerSecret', 'consumerSecret')
    .property('oauthToken', 'token')
    .property('oauthTokenSecret', 'tokenSecret')
    .property('path', '/api/')

Create a user, update user, delete user, and then logout:

student = student:
    first_name: 'test'
    last_name: 'test'
    student_number: 123456

context.withSession((masteryconnect) ->
    masteryconnect.postStudent(student) # Create.
        .then((response) -> response.fold(((r) -> r.student.id), -1)) # Get created id.
        .then((id) -> masteryconnect.putStudent(id, student: first_name: 'updated'); id) # Update.
        .then((id) -> masteryconnect.deleteStudent(id)) # Delete.
        .done() # All done, no logout needed (see note below).
)

More usage examples available via the project unit and integration tests. NOTE: MasteryConnect uses a persisted token based authentication method and closing the session is not needed.

Licensing

The MIT License (MIT)

Copyright (c) 2013 Rocky Madden (http://rockymadden.com/)

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.
npm loves you