Class: Stripe::Billing::Alert
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Billing::Alert
- Extended by:
- APIOperations::Create, APIOperations::List
- Defined in:
- lib/stripe/resources/billing/alert.rb
Overview
A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
Defined Under Namespace
Classes: UsageThreshold
Constant Summary collapse
- OBJECT_NAME =
"billing.alert"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#alert_type ⇒ Object
readonly
Defines the type of the alert.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#status ⇒ Object
readonly
Status of the alert.
-
#title ⇒ Object
readonly
Title of the alert.
-
#usage_threshold ⇒ Object
readonly
Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](stripe.com/docs/api/billing/meter).
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.activate(id, params = {}, opts = {}) ⇒ Object
Reactivates this alert, allowing it to trigger again.
-
.archive(id, params = {}, opts = {}) ⇒ Object
Archives this alert, removing it from the list view and APIs.
-
.create(params = {}, opts = {}) ⇒ Object
Creates a billing alert.
-
.deactivate(id, params = {}, opts = {}) ⇒ Object
Deactivates this alert, preventing it from triggering.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Lists billing active and inactive alerts.
- .object_name ⇒ Object
Instance Method Summary collapse
-
#activate(params = {}, opts = {}) ⇒ Object
Reactivates this alert, allowing it to trigger again.
-
#archive(params = {}, opts = {}) ⇒ Object
Archives this alert, removing it from the list view and APIs.
-
#deactivate(params = {}, opts = {}) ⇒ Object
Deactivates this alert, preventing it from triggering.
Methods included from APIOperations::Create
Methods included from APIOperations::List
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
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, 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
#alert_type ⇒ Object (readonly)
Defines the type of the alert.
49 50 51 |
# File 'lib/stripe/resources/billing/alert.rb', line 49 def alert_type @alert_type end |
#id ⇒ Object (readonly)
Unique identifier for the object.
51 52 53 |
# File 'lib/stripe/resources/billing/alert.rb', line 51 def id @id end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
53 54 55 |
# File 'lib/stripe/resources/billing/alert.rb', line 53 def livemode @livemode end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
55 56 57 |
# File 'lib/stripe/resources/billing/alert.rb', line 55 def object @object end |
#status ⇒ Object (readonly)
Status of the alert. This can be active, inactive or archived.
57 58 59 |
# File 'lib/stripe/resources/billing/alert.rb', line 57 def status @status end |
#title ⇒ Object (readonly)
Title of the alert.
59 60 61 |
# File 'lib/stripe/resources/billing/alert.rb', line 59 def title @title end |
#usage_threshold ⇒ Object (readonly)
Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](stripe.com/docs/api/billing/meter).
61 62 63 |
# File 'lib/stripe/resources/billing/alert.rb', line 61 def usage_threshold @usage_threshold end |
Class Method Details
.activate(id, params = {}, opts = {}) ⇒ Object
Reactivates this alert, allowing it to trigger again.
74 75 76 77 78 79 80 81 |
# File 'lib/stripe/resources/billing/alert.rb', line 74 def self.activate(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.archive(id, params = {}, opts = {}) ⇒ Object
Archives this alert, removing it from the list view and APIs. This is non-reversible.
94 95 96 97 98 99 100 101 |
# File 'lib/stripe/resources/billing/alert.rb', line 94 def self.archive(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Creates a billing alert
104 105 106 |
# File 'lib/stripe/resources/billing/alert.rb', line 104 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/billing/alerts", params: params, opts: opts) end |
.deactivate(id, params = {}, opts = {}) ⇒ Object
Deactivates this alert, preventing it from triggering.
119 120 121 122 123 124 125 126 |
# File 'lib/stripe/resources/billing/alert.rb', line 119 def self.deactivate(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.field_remappings ⇒ Object
137 138 139 |
# File 'lib/stripe/resources/billing/alert.rb', line 137 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
133 134 135 |
# File 'lib/stripe/resources/billing/alert.rb', line 133 def self.inner_class_types @inner_class_types = { usage_threshold: UsageThreshold } end |
.list(params = {}, opts = {}) ⇒ Object
Lists billing active and inactive alerts
129 130 131 |
# File 'lib/stripe/resources/billing/alert.rb', line 129 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/billing/alerts", params: params, opts: opts) end |
.object_name ⇒ Object
12 13 14 |
# File 'lib/stripe/resources/billing/alert.rb', line 12 def self.object_name "billing.alert" end |
Instance Method Details
#activate(params = {}, opts = {}) ⇒ Object
Reactivates this alert, allowing it to trigger again.
64 65 66 67 68 69 70 71 |
# File 'lib/stripe/resources/billing/alert.rb', line 64 def activate(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#archive(params = {}, opts = {}) ⇒ Object
Archives this alert, removing it from the list view and APIs. This is non-reversible.
84 85 86 87 88 89 90 91 |
# File 'lib/stripe/resources/billing/alert.rb', line 84 def archive(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#deactivate(params = {}, opts = {}) ⇒ Object
Deactivates this alert, preventing it from triggering.
109 110 111 112 113 114 115 116 |
# File 'lib/stripe/resources/billing/alert.rb', line 109 def deactivate(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |