Class: SimpleConnect::Responses::VerifyResponse
- Inherits:
-
Object
- Object
- SimpleConnect::Responses::VerifyResponse
- Defined in:
- lib/simple_connect/responses/verify_response.rb
Overview
Wraps the ‘integrations.verify` success payload. Exposes the integration metadata (provider, status) plus an array of `EventFlow` objects — one per event key the integration supports, with its enabled/attention state and (optional) linked template.
Defined Under Namespace
Classes: EventFlow
Instance Attribute Summary collapse
-
#event_flows ⇒ Object
readonly
Returns the value of attribute event_flows.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #connected? ⇒ Boolean
- #event_flow(event_key) ⇒ Object
-
#initialize(json) ⇒ VerifyResponse
constructor
A new instance of VerifyResponse.
- #to_h ⇒ Object
Constructor Details
#initialize(json) ⇒ VerifyResponse
Returns a new instance of VerifyResponse.
12 13 14 15 16 17 18 |
# File 'lib/simple_connect/responses/verify_response.rb', line 12 def initialize(json) @json = json.is_a?(Hash) ? json : {} integration = @json["integration"].is_a?(Hash) ? @json["integration"] : {} @provider = integration["provider"] @status = integration["status"] @event_flows = Array(@json["event_flows"]).map { |ef| EventFlow.new(ef) } end |
Instance Attribute Details
#event_flows ⇒ Object (readonly)
Returns the value of attribute event_flows.
10 11 12 |
# File 'lib/simple_connect/responses/verify_response.rb', line 10 def event_flows @event_flows end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
10 11 12 |
# File 'lib/simple_connect/responses/verify_response.rb', line 10 def provider @provider end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/simple_connect/responses/verify_response.rb', line 10 def status @status end |
Instance Method Details
#connected? ⇒ Boolean
20 21 22 |
# File 'lib/simple_connect/responses/verify_response.rb', line 20 def connected? @status == "connected" end |
#event_flow(event_key) ⇒ Object
24 25 26 27 |
# File 'lib/simple_connect/responses/verify_response.rb', line 24 def event_flow(event_key) key = event_key.to_s @event_flows.find { |f| f.event_key == key } end |
#to_h ⇒ Object
29 30 31 |
# File 'lib/simple_connect/responses/verify_response.rb', line 29 def to_h @json.dup end |