0.0
No release in over a year
The PromptJoy ruby gem provides a simple and efficient way to interact with the PromptJoy API in Ruby. It handles the API authentication, request formation, and response parsing, providing the users with an intuitive interface to make API calls and retrieve the data.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0
~> 3.0
 Project Readme

PromptJoy Ruby Gem

Welcome to the official Ruby client for the PromptJoy.

PromptJoy is a platform that enables you to build scalable APIs by simply describing what you want.

Example APIs built on PromptJoy:

Installation

Add this line to your application's Gemfile:

gem 'promptjoy-ruby'

And then execute:

bundle install

Or install it yourself as:

gem install promptjoy-ruby

Usage

require 'promptjoy-ruby'

client = PromptjoyRuby::Client.new('your_api_key')

You can find the API you want to interact with by using its URL. You can find the URL in the endpoint field of the API's page:

api = client.find_by_api_url('https://api.promptjoy.com/api/id')

You can also just find the API by its id:

api = client.find('id')

To call the API, pass in the data as a Hash:

response = api.call({
  key1: 'value1',
  key2: 'value2'
})

Example

The following example uses PromptJoy to build an API that recommends an open-source software package based on a problem to be solved: https://promptjoy.com/apis/jNqC7A

> require 'promptjoy-ruby'
> client = PromptjoyRuby::Client.new('***********************')
> api = client.find_by_api_url('https://api.promptjoy.com/api/jNqC7A')
> response = api.call({problem: "queue processing in ruby"})
> puts response

{"software"=>"Sidekiq", "reason"=>"Efficient and reliable background processing 
for Ruby", "github_url"=>"https://github.com/mperham/sidekiq"}

Error Handling

If an error occurs during an API call, an instance of PromptjoyRuby::Error is raised with a message indicating the nature of the error.

begin
  api.call(some_data)
rescue PromptjoyRuby::Error => e
  puts "An error occurred: #{e.message}"
end

More about PromptJoy

Please email any feedback to team@promptjoy.com.

License

The gem is available as open source under the terms of the MIT License.