Class: Agents::AcumenOrderAgent
Instance Method Summary
collapse
#fetch_invoice_details, #map_line_item_data, #process_invoice_detail_response
#fetch_invoice_data, #process_invoice_response
Instance Method Details
#check ⇒ Object
93
94
95
|
# File 'lib/huginn_acumen_order_agent/acumen_order_agent.rb', line 93
def check
handle interpolated['payload'].presence || {}
end
|
#default_options ⇒ Object
62
63
64
65
66
67
68
69
|
# File 'lib/huginn_acumen_order_agent/acumen_order_agent.rb', line 62
def default_options
{
'endpoint' => 'https://example.com',
'site_code' => '',
'password' => '',
'output_mode' => 'clean',
}
end
|
#receive(incoming_events) ⇒ Object
97
98
99
100
101
|
# File 'lib/huginn_acumen_order_agent/acumen_order_agent.rb', line 97
def receive(incoming_events)
incoming_events.each do |event|
handle(event)
end
end
|
#validate_options ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/huginn_acumen_order_agent/acumen_order_agent.rb', line 71
def validate_options
unless options['endpoint'].present?
errors.add(:base, 'endpoint is a required field')
end
unless options['site_code'].present?
errors.add(:base, 'site_code is a required field')
end
unless options['password'].present?
errors.add(:base, 'password is a required field')
end
if options['output_mode'].present? && !options['output_mode'].to_s.include?('{') && !%[clean merge].include?(options['output_mode'].to_s)
errors.add(:base, "if provided, output_mode must be 'clean' or 'merge'")
end
end
|
#working? ⇒ Boolean
89
90
91
|
# File 'lib/huginn_acumen_order_agent/acumen_order_agent.rb', line 89
def working?
received_event_without_error?
end
|