0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby client for Lesson.ly API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Lessonly Ruby Client

Ruby client for Lesson.ly API.

Installation

Add the following line to your application's Gemfile

gem 'lessonly-ruby'

And then run bundle install.

Running tests

Run rake ci to run rubocop and rspec tests.

Usage

First, configure your client:

require 'lessonly'

Lessonly.configure do |config|
  config.root_url = 'https://api.lesson.ly/api/v1'
  config.api_key = `LESSONLY API KEY`
  config.domain = `LESSONLY SUBDOMAIN`
end

This is best done in an application initializer inside config/initializers.

From here, you can interact with the Lessonly API resources however you wish:

Users

all_users = Lessonly::User.all

skylar = Lessonly::User.find(user_id)
skylar.name # "Skylar Anderson"
skylar.email # "skylar@aptible.com"

frank = Lessonly::User.create({ name: 'Frank Macreery', email: 'frank@aptible.com', role: 'learner' })
frank.name # "Frank Macreery"

Groups

all_groups = Lessonly::Group.all
developers = Lessonly::Group.find(group_id)

Add a user to a group

developers = Lessonly::Group.find(group_id)

developers.create_membership(skylar) # Add Skylar to developers group
developers.create_membership(frank) # Add Frank to developers group

Courses

all_courses = Lessonly::Course.all

course = Lessonly::Course.find(course_id)
course.create_assignment(skylar, 1.year.from_now) # Skylar assigned to course, due in 1 year

course.assignments.count # 1
course.assignments.first.user.name # "Skylar"
course.assignments.first.user.email # "skylar@aptible.com"

course.lessons.count # 1
course.lessons.first.title # "Developer Lesson"

Assign a course to a user

course = Lessonly::Course.find(course_id)
user = Lessonly::User.find(user_id)

course.create_assignment(skylar, 1.month.from_now) # User assigned to course, due in a month

Contributing

  1. Fork the project.
  2. Commit your changes, with specs.
  3. Ensure that your code passes specs (rake spec) and meets Aptible's Ruby style guide (rake rubocop).
  4. Create a new pull request on GitHub.

Copyright and License

MIT License, see LICENSE for details.

Copyright (c) 2014 Aptible and contributors.

@sandersonet