Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

defra_ruby_storm

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defra_ruby_storm

bundlerRubyGems.org
Version
0.1.0
Version published
Maintainers
1
Created
Source

DefraRuby::Storm

Build Status Maintainability Rating Coverage Gem Version Licence

Ruby client for Storm Web Services API

Table of Contents

Installation

Add this line to your application's Gemfile:

gem 'defra-ruby-storm'

And then execute

bundle install

Or install it yourself as:

gem install defra-ruby-storm

Configuration

You just need to let the gem know the STORM_API_USERNAME AND STORM_API_PASSWORD for the Api access.

# config/initializers/defra_ruby_storm.rb
require "defra_ruby/storm"

DefraRuby::Storm.configure do |config|
  config.storm_api_username = "STORM_API_USERNAME"
  config.storm_api_password = "STORM_API_PASSWORD"
end

Usage

The gem provides 3 separate services a host app can use:

  • DefraRuby::Storm::UserDetailsService
  • DefraRuby::Storm::PauseCallRecordingService
  • DefraRuby::Storm::ResumeCallRecordingService

User Details Service

DefraRuby::Storm::UserDetailsService.run(username: 'TestAgentUsername')

#<DefraRuby::Storm::GetUserDetailsResponse:0x00007f6b9a3c5160
 @alternative_number=nil,                        
 @code="0",
 @first_name="First Name",
 @home_tel=nil,
 @last_name="Last Name",
 @mobile=nil,
 @personal_email=nil,
 @user_id="123",
 @user_name="TestAgentUsername",
 @work_email=nil,
 @work_tel=nil>

code "0" in api response suggests that the request has been handled successfully

Pause Call Recording Service

DefraRuby::Storm::PauseCallRecordingService.run(username: 'TestAgentUsername')

#<DefraRuby::Storm::RecordingResponse:0x00007f6b99c0f9e8 @result="0">

result code "0" in api response suggests that the request has been handled successfully

Knowing the agent's user ID, we can pass that into the service, eliminating the need for an additional API call and making request much faster.

DefraRuby::Storm::PauseCallRecordingService.run(agent_user_id: 123)

Resume Call Recording Service

DefraRuby::Storm::ResumeCallRecordingService.run(username: 'TestAgentUsername')

#<DefraRuby::Storm::RecordingResponse:0x00007f6b99c0f9e8 @result="0">

result code "0" in api response suggests that the request has been handled successfully

Knowing the agent's user ID, we can pass that into the service, eliminating the need for an additional API call and making request much faster.

DefraRuby::Storm::ResumeCallRecordingService.run(agent_user_id: 123)

Error Handling

Errors are handled through the DefraRuby::Storm::ApiError class. Here's an example of how you can handle errors:

begin
  # some code that might raise an error
rescue DefraRuby::Storm::ApiError => e
  puts "An error occurred: #{e.message}"
end

Testing

bundle exec rspec

FAQs

Package last updated on 03 Nov 2023

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