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.



1010
1011
1012
1013
1014
1015
1016
1017
# File 'lib/stripe/resources/terminal/reader.rb', line 1010

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



1005
1006
1007
# File 'lib/stripe/resources/terminal/reader.rb', line 1005

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.



1030
1031
1032
1033
1034
1035
1036
1037
# File 'lib/stripe/resources/terminal/reader.rb', line 1030

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.



1050
1051
1052
1053
1054
1055
1056
1057
# File 'lib/stripe/resources/terminal/reader.rb', line 1050

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.



1020
1021
1022
1023
1024
1025
1026
1027
# File 'lib/stripe/resources/terminal/reader.rb', line 1020

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.



1040
1041
1042
1043
1044
1045
1046
1047
# File 'lib/stripe/resources/terminal/reader.rb', line 1040

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.



1060
1061
1062
1063
1064
1065
1066
1067
# File 'lib/stripe/resources/terminal/reader.rb', line 1060

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