Class: ExperianAddressValidation::Operation
- Inherits:
-
Object
- Object
- ExperianAddressValidation::Operation
- Defined in:
- lib/experian_address_validation/operation.rb
Overview
Base class for API operations
Direct Known Subclasses
ExperianAddressValidation::Operations::Format, ExperianAddressValidation::Operations::Search
Constant Summary collapse
- DEFAULT_HEADERS =
{ content_type: "application/json" }.freeze
Instance Method Summary collapse
- #execute ⇒ Object
- #http_method ⇒ Object
-
#initialize(options = {}) ⇒ Operation
constructor
A new instance of Operation.
Constructor Details
#initialize(options = {}) ⇒ Operation
Returns a new instance of Operation.
10 11 12 |
# File 'lib/experian_address_validation/operation.rb', line 10 def initialize( = {}) @options = end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/experian_address_validation/operation.rb', line 14 def execute http_client.headers["Auth-Token"] = auth_token response = http_client.run_request(http_method, endpoint, json_payload, headers) return json_response(response) if response.success? raise ExperianAddressValidation::Errors::ResponseError.new(body: response.body, status: response.status) end |
#http_method ⇒ Object
24 25 26 |
# File 'lib/experian_address_validation/operation.rb', line 24 def http_method :post end |