Sha256: 11f7578e63569652eae239977c913a0a8de7e29ef3da58e4d963ec74305d6a63

Contents?: true

Size: 1.13 KB

Versions: 46

Compression:

Stored size: 1.13 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  class EphemeralKey < APIResource
    extend Stripe::APIOperations::Create
    include Stripe::APIOperations::Delete

    OBJECT_NAME = "ephemeral_key"
    def self.object_name
      "ephemeral_key"
    end

    # Invalidates a short-lived API key for a given resource.
    def self.delete(id, params = {}, opts = {})
      request_stripe_object(
        method: :delete,
        path: format("/v1/ephemeral_keys/%<id>s", { id: CGI.escape(id) }),
        params: params,
        opts: opts
      )
    end

    # Invalidates a short-lived API key for a given resource.
    def delete(params = {}, opts = {})
      request_stripe_object(
        method: :delete,
        path: format("/v1/ephemeral_keys/%<key>s", { key: CGI.escape(self["id"]) }),
        params: params,
        opts: opts
      )
    end

    def self.create(params = {}, opts = {})
      opts = Util.normalize_opts(opts)
      unless opts[:stripe_version]
        raise ArgumentError,
              "stripe_version must be specified to create an ephemeral key"
      end
      super
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
stripe-10.14.0 lib/stripe/resources/ephemeral_key.rb
stripe-10.14.0.pre.beta.1 lib/stripe/resources/ephemeral_key.rb
stripe-10.13.0 lib/stripe/resources/ephemeral_key.rb
stripe-10.13.0.pre.beta.1 lib/stripe/resources/ephemeral_key.rb
stripe-10.12.0 lib/stripe/resources/ephemeral_key.rb
stripe-10.12.0.pre.beta.1 lib/stripe/resources/ephemeral_key.rb