Class: Stripe::GiftCardService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/gift_card_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

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

Activates a third-party gift card and optionally sets its balance.



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

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

#cashout(gift_card, params = {}, opts = {}) ⇒ Object

Cashout a third-party gift card by zeroing its balance.



18
19
20
21
22
23
24
25
26
# File 'lib/stripe/services/gift_card_service.rb', line 18

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

#check_balance(gift_card, params = {}, opts = {}) ⇒ Object

Checks the balance of a third-party gift card.



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

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

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

Creates a gift card object.



40
41
42
# File 'lib/stripe/services/gift_card_service.rb', line 40

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

#reload(gift_card, params = {}, opts = {}) ⇒ Object

Reloads a third-party gift card by adding the specified amount to its balance.



45
46
47
48
49
50
51
52
53
# File 'lib/stripe/services/gift_card_service.rb', line 45

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

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

Retrieves a third-party gift card object.



56
57
58
59
60
61
62
63
64
# File 'lib/stripe/services/gift_card_service.rb', line 56

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

#void_operation(gift_card, params = {}, opts = {}) ⇒ Object

Voids a previously performed gift card operation.



67
68
69
70
71
72
73
74
75
# File 'lib/stripe/services/gift_card_service.rb', line 67

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