Class: Stripe::GiftCards::CardService

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

Defined Under Namespace

Classes: CreateParams, ListParams, RetrieveParams, UpdateParams, ValidateParams

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

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

Creates a new gift card object.



128
129
130
131
132
133
134
135
136
# File 'lib/stripe/services/gift_cards/card_service.rb', line 128

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

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

List gift cards for an account



139
140
141
142
143
144
145
146
147
# File 'lib/stripe/services/gift_cards/card_service.rb', line 139

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

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

Retrieve a gift card by id



150
151
152
153
154
155
156
157
158
# File 'lib/stripe/services/gift_cards/card_service.rb', line 150

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

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

Update a gift card



161
162
163
164
165
166
167
168
169
# File 'lib/stripe/services/gift_cards/card_service.rb', line 161

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

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

Validates a gift card code, returning the matching gift card object if it exists.



172
173
174
175
176
177
178
179
180
# File 'lib/stripe/services/gift_cards/card_service.rb', line 172

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