Module: Alchemrest
- Defined in:
- lib/alchemrest/url_builder.rb,
lib/alchemrest.rb,
lib/alchemrest/data.rb,
lib/alchemrest/root.rb,
lib/alchemrest/error.rb,
lib/alchemrest/client.rb,
lib/alchemrest/result.rb,
lib/alchemrest/railtie.rb,
lib/alchemrest/request.rb,
lib/alchemrest/version.rb,
lib/alchemrest/response.rb,
lib/alchemrest/hash_path.rb,
lib/alchemrest/data/field.rb,
lib/alchemrest/data/graph.rb,
lib/alchemrest/transforms.rb,
lib/alchemrest/data/record.rb,
lib/alchemrest/data/schema.rb,
lib/alchemrest/factory_bot.rb,
lib/alchemrest/kill_switch.rb,
lib/alchemrest/result/halt.rb,
lib/alchemrest/http_request.rb,
lib/alchemrest/circuit_breaker.rb,
lib/alchemrest/request/returns.rb,
lib/alchemrest/transforms/enum.rb,
lib/alchemrest/webmock_helpers.rb,
lib/alchemrest/request/endpoint.rb,
lib/alchemrest/transforms/typed.rb,
lib/alchemrest/transforms/union.rb,
lib/alchemrest/response/pipeline.rb,
lib/alchemrest/transforms/number.rb,
lib/alchemrest/request_definition.rb,
lib/alchemrest/result/try_helpers.rb,
lib/alchemrest/transforms/to_type.rb,
lib/alchemrest/endpoint_definition.rb,
lib/alchemrest/transforms/iso_time.rb,
lib/alchemrest/url_builder/options.rb,
lib/alchemrest/client/configuration.rb,
lib/alchemrest/kill_switch/adapters.rb,
lib/alchemrest/transforms/from_type.rb,
lib/alchemrest/url_builder/encoders.rb,
lib/alchemrest/transforms/constraint.rb,
lib/alchemrest/transforms/epoch_time.rb,
lib/alchemrest/transforms/from_chain.rb,
lib/alchemrest/transforms/loose_hash.rb,
lib/alchemrest/transforms/to_decimal.rb,
lib/alchemrest/response/pipeline/omit.rb,
lib/alchemrest/transforms/from_number.rb,
lib/alchemrest/transforms/from_string.rb,
lib/alchemrest/transforms/json_number.rb,
lib/alchemrest/transforms/output_type.rb,
lib/alchemrest/response/pipeline/final.rb,
lib/alchemrest/transforms/constrainable.rb,
lib/alchemrest/response_captured_handler.rb,
lib/alchemrest/transforms/date_transform.rb,
lib/alchemrest/data/capture_configuration.rb,
lib/alchemrest/request_definition/builder.rb,
lib/alchemrest/response/pipeline/sanitize.rb,
lib/alchemrest/transforms/money_transform.rb,
lib/alchemrest/transforms/with_constraint.rb,
lib/alchemrest/response/pipeline/transform.rb,
lib/alchemrest/transforms/constraint/block.rb,
lib/alchemrest/transforms/constraint/in_list.rb,
lib/alchemrest/transforms/constraint/is_uuid.rb,
lib/alchemrest/transforms/constraint_builder.rb,
lib/alchemrest/faraday_middleware/json_parser.rb,
lib/alchemrest/faraday_middleware/kill_switch.rb,
lib/alchemrest/client/configuration/connection.rb,
lib/alchemrest/transforms/constraint/less_than.rb,
lib/alchemrest/response/pipeline/was_successful.rb,
lib/alchemrest/transforms/constraint/max_length.rb,
lib/alchemrest/transforms/constraint/min_length.rb,
lib/alchemrest/response/pipeline/extract_payload.rb,
lib/alchemrest/transforms/constraint/greater_than.rb,
lib/alchemrest/transforms/constraint/matches_regex.rb,
lib/alchemrest/transforms/constraint/is_instance_of.rb,
lib/alchemrest/transforms/constraint/less_than_or_eq.rb,
lib/alchemrest/faraday_middleware/underscore_response.rb,
lib/alchemrest/transforms/to_type/transforms_selector.rb,
lib/alchemrest/transforms/constraint/greater_than_or_eq.rb,
lib/alchemrest/transforms/constraint_builder/for_number.rb,
lib/alchemrest/transforms/constraint_builder/for_string.rb,
lib/alchemrest/transforms/base_to_type_transform_registry.rb,
lib/generators/alchemrest/kill_switch_migration_generator.rb,
lib/alchemrest/faraday_middleware/external_api_instrumentation.rb,
lib/alchemrest/transforms/to_type/from_string_to_time_selector.rb,
lib/alchemrest/transforms/from_number/to_type_transform_registry.rb,
lib/alchemrest/transforms/from_string/to_type_transform_registry.rb,
lib/alchemrest/transforms/from_type/empty_to_type_transform_registry.rb
Overview
typed: true frozen_string_literal: true
Defined Under Namespace
Modules: FactoryBot, FaradayMiddleware, Transforms, WebmockHelpers
Classes: AuthError, CircuitBreaker, CircuitOpenError, Client, ClientError, ConfigurationNotReadyError, Data, EndpointDefinition, Error, HashPath, HttpRequest, InvalidConfigurationError, KillSwitch, KillSwitchEnabledError, KillSwitchMigrationGenerator, MorpherTransformError, NoRegisteredTransformError, NoTransformOptionForNameError, NotFoundError, Railtie, Request, RequestDefinition, RequestFailedError, Response, ResponseCapturedHandler, ResponseError, ResponsePipelineError, Result, ResultRescued, Root, ServerError, TimeoutError, TransformError, UndefinedClientError, UrlBuilder
Constant Summary
collapse
- DEFAULT_RESCUABLE_EXCEPTIONS =
[Alchemrest::Error].freeze
- DEFAULT_FILTER_PARAMETERS =
%i(ssn password token).freeze
- VERSION =
"3.2.2"
Class Method Summary
collapse
Class Method Details
.deprecator ⇒ Object
103
104
105
|
# File 'lib/alchemrest.rb', line 103
def self.deprecator
@deprecator ||= ActiveSupport::Deprecation.new("3.0", "Alchemrest")
end
|
.filter_parameters ⇒ Object
107
108
109
|
# File 'lib/alchemrest.rb', line 107
def self.filter_parameters
@filter_parameters
end
|
.filter_parameters=(params) ⇒ Object
111
112
113
|
# File 'lib/alchemrest.rb', line 111
def self.filter_parameters=(params)
@filter_parameters = params.uniq
end
|
.handle_rescued_result(error) ⇒ Object
136
137
138
139
140
141
142
|
# File 'lib/alchemrest.rb', line 136
def self.handle_rescued_result(error)
if @on_result_rescued
@on_result_rescued.call(error)
else
logger.warn(error.to_s)
end
end
|
.kill_switch_adapter ⇒ Object
.kill_switch_adapter=(adapter) ⇒ Object
156
157
158
|
# File 'lib/alchemrest.rb', line 156
def self.kill_switch_adapter=(adapter)
@kill_switch_adapter = adapter
end
|
.logger ⇒ Object
94
95
96
|
# File 'lib/alchemrest.rb', line 94
def self.logger
@logger ||= Logger.new($stdout)
end
|
.logger=(logger) ⇒ Object
98
99
100
|
# File 'lib/alchemrest.rb', line 98
def self.logger=(logger)
@logger = logger
end
|
.on_response_captured(&block) ⇒ Object
123
124
125
126
|
# File 'lib/alchemrest.rb', line 123
def self.on_response_captured(&block)
@on_response_captured = block if block
@on_response_captured
end
|
.on_result_rescued(&block) ⇒ Object
119
120
121
|
# File 'lib/alchemrest.rb', line 119
def self.on_result_rescued(&block)
@on_result_rescued = block if block
end
|
.parameter_filter ⇒ Object
115
116
117
|
# File 'lib/alchemrest.rb', line 115
def self.parameter_filter
ActiveSupport::ParameterFilter.new(@filter_parameters)
end
|
.rescuable_exceptions ⇒ Object
.rescuable_exceptions=(exceptions) ⇒ Object
148
149
150
|
# File 'lib/alchemrest.rb', line 148
def self.rescuable_exceptions=(exceptions)
@rescuable_exceptions = exceptions
end
|
.restore_default_response_capture_behavior ⇒ Object
132
133
134
|
# File 'lib/alchemrest.rb', line 132
def self.restore_default_response_capture_behavior
@on_response_captured = nil
end
|
.restore_default_result_rescue_behavior ⇒ Object
128
129
130
|
# File 'lib/alchemrest.rb', line 128
def self.restore_default_result_rescue_behavior
@on_result_rescued = nil
end
|