Class: GoCardlessPro::Resources::ScenarioSimulator

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/scenario_simulator.rb

Overview

Scenario Simulators allow you to manually trigger and test certain paths that your integration will encounter in the real world. These endpoints are only active in the sandbox environment.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ ScenarioSimulator

Initialize a scenario_simulator resource instance

Parameters:

  • object (Hash)

    an object returned from the API



23
24
25
26
27
28
# File 'lib/gocardless_pro/resources/scenario_simulator.rb', line 23

def initialize(object, response = nil)
  @object = object

  @id = object['id']
  @response = response
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/gocardless_pro/resources/scenario_simulator.rb', line 19

def id
  @id
end

Instance Method Details

#api_responseObject



30
31
32
# File 'lib/gocardless_pro/resources/scenario_simulator.rb', line 30

def api_response
  ApiResponse.new(@response)
end

#to_hObject

Provides the scenario_simulator resource as a hash of all its readable attributes



35
36
37
# File 'lib/gocardless_pro/resources/scenario_simulator.rb', line 35

def to_h
  @object
end