Class: Stripe::TopupService

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

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

#cancel(topup, params = {}, opts = {}) ⇒ Object

Cancels a top-up. Only pending top-ups can be canceled.



7
8
9
10
11
12
13
14
15
# File 'lib/stripe/services/topup_service.rb', line 7

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

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

Top up the balance of an account



18
19
20
# File 'lib/stripe/services/topup_service.rb', line 18

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

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

Returns a list of top-ups.



23
24
25
# File 'lib/stripe/services/topup_service.rb', line 23

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

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

Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information.



28
29
30
31
32
33
34
35
36
# File 'lib/stripe/services/topup_service.rb', line 28

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

#update(topup, params = {}, opts = {}) ⇒ Object

Updates the metadata of a top-up. Other top-up details are not editable by design.



39
40
41
42
43
44
45
46
47
# File 'lib/stripe/services/topup_service.rb', line 39

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