Sha256: 05c75bcb129c523bb736122a04c9af9e171003a078f058366e86a8811a833bbf

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

require 'openssl'

module Eligible
  class PublicKey < APIResource
    def self.get(params, opts = {})
      send_request :get, api_url('public_keys', params, :key_id), params, **opts.merge(required_params: [:key_id])
    end

    def self.post(params, opts = {})
      send_request :post, api_url('public_keys'), params, **opts
    end

    def self.activate(params, opts = {})
      key_id = Util.value(params, :key_id)
      send_request :get, "/public_keys/#{key_id}/activate", params, **opts.merge(required_params: [:key_id])
    end

    def self.all(params, opts = {})
      send_request :get, api_url('public_keys'), params, **opts
    end

    def self.create_pair
      rsa_key = OpenSSL::PKey::RSA.new(4096)
      [ rsa_key.to_pem, rsa_key.public_key.to_pem ]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eligible-3.1.0.beta3 lib/eligible/public_key.rb
eligible-3.1.0.beta2 lib/eligible/public_key.rb
eligible-3.1.0.beta1 lib/eligible/public_key.rb