Class: Stripe::Terminal::Reader::TestHelpers

Inherits:
APIResourceTestHelpers show all
Defined in:
lib/stripe/resources/terminal/reader.rb

Constant Summary collapse

RESOURCE_CLASS =
Reader

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResourceTestHelpers

custom_method, #initialize, resource_url, #resource_url

Methods included from APIOperations::Request

included

Constructor Details

This class inherits a constructor from Stripe::APIResourceTestHelpers

Class Method Details

.present_payment_method(reader, params = {}, opts = {}) ⇒ Object

Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.



1251
1252
1253
1254
1255
1256
1257
1258
# File 'lib/stripe/resources/terminal/reader.rb', line 1251

def self.present_payment_method(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.resource_classObject



1246
1247
1248
# File 'lib/stripe/resources/terminal/reader.rb', line 1246

def self.resource_class
  "Reader"
end

.succeed_input_collection(reader, params = {}, opts = {}) ⇒ Object

Use this endpoint to trigger a successful input collection on a simulated reader.



1271
1272
1273
1274
1275
1276
1277
1278
# File 'lib/stripe/resources/terminal/reader.rb', line 1271

def self.succeed_input_collection(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/succeed_input_collection", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

.timeout_input_collection(reader, params = {}, opts = {}) ⇒ Object

Use this endpoint to complete an input collection with a timeout error on a simulated reader.



1291
1292
1293
1294
1295
1296
1297
1298
# File 'lib/stripe/resources/terminal/reader.rb', line 1291

def self.timeout_input_collection(reader, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/timeout_input_collection", { reader: CGI.escape(reader) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

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

Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.



1261
1262
1263
1264
1265
1266
1267
1268
# File 'lib/stripe/resources/terminal/reader.rb', line 1261

def present_payment_method(params = {}, opts = {})
  @resource.request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(@resource["id"]) }),
    params: params,
    opts: opts
  )
end

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

Use this endpoint to trigger a successful input collection on a simulated reader.



1281
1282
1283
1284
1285
1286
1287
1288
# File 'lib/stripe/resources/terminal/reader.rb', line 1281

def succeed_input_collection(params = {}, opts = {})
  @resource.request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/succeed_input_collection", { reader: CGI.escape(@resource["id"]) }),
    params: params,
    opts: opts
  )
end

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

Use this endpoint to complete an input collection with a timeout error on a simulated reader.



1301
1302
1303
1304
1305
1306
1307
1308
# File 'lib/stripe/resources/terminal/reader.rb', line 1301

def timeout_input_collection(params = {}, opts = {})
  @resource.request_stripe_object(
    method: :post,
    path: format("/v1/test_helpers/terminal/readers/%<reader>s/timeout_input_collection", { reader: CGI.escape(@resource["id"]) }),
    params: params,
    opts: opts
  )
end