Project

arbor

0.01
No release in over 3 years
Low commit activity in last 3 years
Interface for the Arbor Education REST API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 0

Runtime

>= 2.0.5
 Project Readme

Ruby Interface for Arbor API

A Ruby interface to Arbor Education API.

Installation

gem install arbor

Usage

require 'arbor'

client = Arbor::Client.new("some-school", "user@email.net", "abc123")

# retrieve all students
students = client.query(:students)

# resources loaded by `query` (listings) are lazily loaded, and will
# generate another request for that specific resource when an attribute is
# requested which isn't already loaded
students.each do |s|
  # extra requests to /rest-v2/students/<id> (s.href) occur here for each item
  puts "#{s.person.legal_first_name} #{s.person.legal_last_name}"
end

# use `retrieve` to get a single resource
student = client.retrieve(:student, 1)

# the default serializer is a class factory that creates a class for each
# resource type, and returns instances of those dynamic classes. you can
# also register your own serialisers:
Arbor.serialisers.register(:students, MyStudentSerialiser)

# and/or modify the default serialiser. serialiser classes must respond to
# `load` and return a single resource
Arbor.serialisers.default_serialiser = MyDefaultSerialiser

Still to do

  • Write tests
  • Support the other stuff like ordering, paging, changelog etc.
  • Include an API mixin for the resource classes
  • Support more than just read (create, edit, destroy?)

Licence

MIT License