Class: Stripe::EphemeralKey

Inherits:
APIResource show all
Extended by:
APIOperations::Create
Includes:
APIOperations::Delete
Defined in:
lib/stripe/resources/ephemeral_key.rb

Defined Under Namespace

Classes: DeleteParams

Constant Summary collapse

OBJECT_NAME =
"ephemeral_key"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::Delete

included

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



23
24
25
# File 'lib/stripe/resources/ephemeral_key.rb', line 23

def created
  @created
end

#expiresObject (readonly)

Time at which the key will expire. Measured in seconds since the Unix epoch.



25
26
27
# File 'lib/stripe/resources/ephemeral_key.rb', line 25

def expires
  @expires
end

#idObject (readonly)

Unique identifier for the object.



27
28
29
# File 'lib/stripe/resources/ephemeral_key.rb', line 27

def id
  @id
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



29
30
31
# File 'lib/stripe/resources/ephemeral_key.rb', line 29

def livemode
  @livemode
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



31
32
33
# File 'lib/stripe/resources/ephemeral_key.rb', line 31

def object
  @object
end

#secretObject (readonly)

The key’s secret. You can use this value to make authorized requests to the Stripe API.



33
34
35
# File 'lib/stripe/resources/ephemeral_key.rb', line 33

def secret
  @secret
end

Class Method Details

.create(params = {}, opts = {}) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/stripe/resources/ephemeral_key.rb', line 55

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

.delete(key, params = {}, opts = {}) ⇒ Object

Invalidates a short-lived API key for a given resource.



36
37
38
39
40
41
42
43
# File 'lib/stripe/resources/ephemeral_key.rb', line 36

def self.delete(key, params = {}, opts = {})
  request_stripe_object(
    method: :delete,
    path: format("/v1/ephemeral_keys/%<key>s", { key: CGI.escape(key) }),
    params: params,
    opts: opts
  )
end

.object_nameObject



10
11
12
# File 'lib/stripe/resources/ephemeral_key.rb', line 10

def self.object_name
  "ephemeral_key"
end

Instance Method Details

#delete(params = {}, opts = {}) ⇒ Object

Invalidates a short-lived API key for a given resource.



46
47
48
49
50
51
52
53
# File 'lib/stripe/resources/ephemeral_key.rb', line 46

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