Class: Stripe::Billing::AlertService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/billing/alert_service.rb

Defined Under Namespace

Classes: ActivateParams, ArchiveParams, CreateParams, DeactivateParams, ListParams, RetrieveParams

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#activate(id, params = {}, opts = {}) ⇒ Object

Reactivates this alert, allowing it to trigger again.



121
122
123
124
125
126
127
128
129
# File 'lib/stripe/services/billing/alert_service.rb', line 121

def activate(id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#archive(id, params = {}, opts = {}) ⇒ Object

Archives this alert, removing it from the list view and APIs. This is non-reversible.



132
133
134
135
136
137
138
139
140
# File 'lib/stripe/services/billing/alert_service.rb', line 132

def archive(id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Creates a billing alert



143
144
145
146
147
148
149
150
151
# File 'lib/stripe/services/billing/alert_service.rb', line 143

def create(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/billing/alerts",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#deactivate(id, params = {}, opts = {}) ⇒ Object

Deactivates this alert, preventing it from triggering.



154
155
156
157
158
159
160
161
162
# File 'lib/stripe/services/billing/alert_service.rb', line 154

def deactivate(id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Lists billing active and inactive alerts



165
166
167
168
169
170
171
172
173
# File 'lib/stripe/services/billing/alert_service.rb', line 165

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v1/billing/alerts",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(id, params = {}, opts = {}) ⇒ Object

Retrieves a billing alert given an ID



176
177
178
179
180
181
182
183
184
# File 'lib/stripe/services/billing/alert_service.rb', line 176

def retrieve(id, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/billing/alerts/%<id>s", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end