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

litmus-infrastructure

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

litmus-infrastructure

  • 0.2.7
  • Rubygems
  • Socket score

Version published
Maintainers
3
Created
Source

Litmus::Infrastructure

A gem that provides an interface between a Ruby application and the Litmus infrastructure API.

Installation

If your production environment will have access to this repo (a user on your production server must have an ssh key that corresponds to a user with access to this repo), you can declare the gem in your gemfile using the github parameter:

gem 'litmus-infrastructure', github: 'litmus/litmus-infrastructure-client'

If you do not have access to the SSH keys in your production environment, when using Heroku for example, you'll need to use a repo URL that includes the API key for a user with access to this repo:

gem 'litmus-infrastructure', git: 'https://GITHUB_API_KEY_XXXXXX@github.com/litmus/litmus-infrastructure-client.git'

Usage

Rails

Include Litmus::Infrastructure in a module that you'd like to have interact with the infrastructure API:

module Checklist
  include Litmus::Infrastructure
end

Your integration should be configured by creating an initializer:

Checklist.configure do |config|
  config.timeout_connect = 5.seconds
  config.timeout_receive = 1.minute
  config.username        = ENV['INFRASTRUCTURE_USERNAME']
  config.password        = ENV['INFRASTRUCTURE_PASSWORD']
  config.url             = ENV['INFRASTRUCTURE_API_BASE_URL']
  config.logger          = Rails.logger
end

Any objects that should act as models for data from the infrastructure API should extend Litmus::Infrastructure::Model:

module Checklist
  class Result < Litmus::Infrastructure::Model
    # ...
  end
end

Your models can define attributes to read from the API using the attributes class method:

module Checklist
  class Result < Litmus::Infrastructure::Model
    attributes :content, :encoding, :from, :grade, :images
    # ...
  end
end

Once your models are defined, you can interact with the infrastructure API using the class methods put, post, and get, passing the appropriate endpoint/action to these methods as the first parameter, and the JSON payload as the second:

Checklist::Result.post('Checklist', { subject: 'Example' }.to_json)

FAQs

Package last updated on 29 Nov 2021

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