GitXplorerGitXplorer
g

signway-ruby-sdk

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
6fce252a0a9b1aa3e4fcc3108fae26eb70b451f7

improve README [skip ci]

ggabotechs committed a year ago
Unverified
eddef29ac2c4c11cc8625fb058f0affd75e8f6fc

tag: v0.1.19

iinvalid-email-address committed a year ago
Unverified
62d8961afbab75ab95f00f5703ccfffcbabe9e78

lint

ggabotechs committed a year ago
Unverified
77812d5f37bb4d7ea625434215813220febea489

tag: v0.1.18

iinvalid-email-address committed a year ago
Unverified
cc1b46b15a16b30e90299495273ca032df2575a4

Merge remote-tracking branch 'origin/main'

ggabotechs committed a year ago
Unverified
5691bd2893df18d96845d59fafa9c44e54ed2616

fix bug

ggabotechs committed a year ago

README

The README file for this repository.

Signway Ruby SDK

The Signway Ruby SDK enables you to generate signed URLs for the Signway service. Signway facilitates a secure, direct request from a client-side application to a third-party API without exposing sensitive credentials.

Install

To install the Signway Ruby SDK, run the following command:

gem install signway_sdk

Usage

require "signway_sdk"

puts SignwaySdk.sign_url(
  # The Application ID.
  # It can be either a Signway managed Application ID (ex: ID0123ABCD...),
  # or the ID provided when launching your own Signway instance (`$ signway <ID> <SECRET>`)
  #                                                                          ^
  id: ENV.fetch("SW_ID"),
  # The Application Secret paired with the provided Application ID.
  # It can be either a Signway managed Application Secret (ex: Gi8p1uZ39cg...),
  # or the Secret provided when launching your own Signway instance (`$ signway <ID> <SECRET>`)
  #                                                                                   ^
  secret: ENV.fetch("SW_SECRET"),
  # The Signway host that will proxy the signed request.
  # If you are using Signway managed, it should be "https://api.signway.io",
  # otherwise, it should be the url where your own Signway instance is listening.
  host: "https://api.signway.io",
  # To which URL the request will be proxy-ed by the Signway host. This url
  # will be embedded into your signed url as a query parameter, that way
  # Signway will know where to proxy the request.
  proxy_url: "https://api.openai.com/v1/completions",
  # The validity period of signed URL in seconds. Signway will reject the request
  # if this number of seconds have happened since the signed URL was created.
  expiry: 10,
  # The method that will be used for performing the request through Signway.
  # If a signed URL with a POST method is created, but when performing the
  # HTTP query to Signway a GET method is used, the request will be rejected.
  method: "POST",
  # [Optional] headers to include in the signature. Any headers set here must
  # also be included in the final HTTP request with the exact value provided here.
  # Additional headers not present here can anyways be sent freely and Signway will
  # not take them into account for validating the request's signature.
  headers: { "Content-Type": "application/json" },
  # [Optional] which body to include in the signature. If provided, the final
  # HTTP request must include exactly this body, otherwise the Signway will reject
  # the request. If not provided, the body will not be taken into account for
  # calculating the signature, and consumers can freely send any body they want.
  body: '{
  "model": "text-davinci-003",
  "stream": true,
  "prompt": "Say this is a test"
}'
)