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.



115
116
117
118
119
120
121
122
123
# File 'lib/stripe/services/gift_cards/card_service.rb', line 115

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



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

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



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

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



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

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.



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

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