Skip to content

bluemango/ScreenSteps-Live-API-Ruby-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

ScreenStepsLive API Ruby Wrapper

Usage

This library users ActiveResource to interact with the ScreenSteps Live API.

To setup do the following:

  require 'screenstepslive_api'
  ScreenStepsLiveAPI.account = 'youraccount'
  ScreenStepsLiveAPI.user = 'username'
  ScreenStepsLiveAPI.password = 'your_password'

All manuals and lessons are retrieved via Spaces. You can pass in the space id.

space = ScreenStepsLiveAPI::Space.find(:first)

OR if your permalink is “mypermalink”

space = ScreenStepsLiveAPI::Space.find("mypermalink")

space.assets gives you all of the assets (Dividers, Manuals, Buckets) for a space

asset = space.assets.first

asset.asset_type returns the asset type.

If it is a manual then we can call:

manual = space.manual(asset.id)

Then we can get the first lesson like so:

  lesson_id = manual.chapters.first.lessons.first.id
  manual.lesson(lesson_id)

Searching

To search just find the space or manual you want to search and do the following:

  space.search("search string")
  manual.search("search string")

Getting Tagged Lessons

You can do the same for tags

  space.lessons_for_tag("Tag name")
  manual.lessons_for_tag("Tag name")

Displaying a Lesson

To display the contents of a lesson. First find the space and manual the lesson is in.

  space = ScreenStepsLiveAPI::Space.find('space_id')
  manual = space.manual(space.manuals.first.id)
  lesson = manual.lesson(manual.chapters.first.lessons.first.id)

Or if you already know the space_id, manual_id and lesson_id:

  lesson = ScreenStepsLiveAPI::Lesson.find(lesson_id, :params => {:space_id => space_id, :manual_id => manual_id})

Now you can iterate over the lesson to display the contents. HAML output might look like this:

  %h1= lesson.title
  .lesson_description= lesson.description
  - lesson.steps.each do |step|
    %h2= step.title
    .lesson_step
      = step.instructions
      - if step.media
        .image
          = image_tag(step.media.url, :width => step.media.width, :height => step.media.height)

About

An Active Resource wrapper for interacting with the ScreenSteps Live API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages