Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gooru

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gooru

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Gooru

The gooru gem allows your Ruby app to talk to the Gooru API

Installation

Add this line to your application's Gemfile:

gem 'gooru'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gooru

Setup

Gooru API key

Some areas of the Gooru API require sign in via an API key.

You may want to request an API key from Gooru before you get started.

Environment variables

If you're using an API key, you may want to store it in an environment variable.

Environment variables can be a way to store sensitive data you don't want in source control.

Consider using a tool like Dotenv to manage these variables across different developer and server environments.

You'll see the environment variable approach used in the examples below.

Usage

Sign In

The Sign In call takes your API key and returns a session token.

If you're using the signed in areas of the Gooru API, you'll need to hang on to the returned session token and use it in later requests.

The Sign In call is not needed if you're only using the public areas of the API.

response = Gooru::SignIn.post(
  apiKey:   ENV["GOORU_API_KEY"],
  userName: ENV["GOORU_USER_NAME"],
  password: ENV["GOORU_PASSWORD"])
  
if response.success?
  puts "You've been authenticated!"
  puts "Your session token is #{response.data['token']}"
else
  puts "You were unable to be authenticated…"
  puts "The error message was: #{response.data['error']}"
end

Required parameters

  • apiKey
  • userName
  • password

Resources

The Resources call takes a query and returns a list of matching resources.

You can optionally pass a session token if you're signed in, but it is not required.

response = Gooru::Resources.get(
  query: "algebra")
  
if response.success?
  results = response.data["searchResults"]
  puts "We found #{results.length} resources matching 'algebra'"
else
  puts "The error message was: #{response.data['error']}"
end    

Required parameters

  • query

Optional parameters

  • sessionToken

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 05 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc