Class: Evil::Client
- Inherits:
-
Object
- Object
- Evil::Client
- Includes:
- Chaining
- Defined in:
- lib/evil/client.rb,
lib/evil/client/names.rb,
lib/evil/client/rspec.rb,
lib/evil/client/policy.rb,
lib/evil/client/schema.rb,
lib/evil/client/builder.rb,
lib/evil/client/options.rb,
lib/evil/client/chaining.rb,
lib/evil/client/resolver.rb,
lib/evil/client/settings.rb,
lib/evil/client/container.rb,
lib/evil/client/formatter.rb,
lib/evil/client/connection.rb,
lib/evil/client/resolver/uri.rb,
lib/evil/client/schema/scope.rb,
lib/evil/client/builder/scope.rb,
lib/evil/client/resolver/body.rb,
lib/evil/client/resolver/query.rb,
lib/evil/client/container/scope.rb,
lib/evil/client/resolver/format.rb,
lib/evil/client/resolver/headers.rb,
lib/evil/client/resolver/request.rb,
lib/evil/client/schema/operation.rb,
lib/evil/client/builder/operation.rb,
lib/evil/client/resolver/response.rb,
lib/evil/client/resolver/security.rb,
lib/evil/client/container/operation.rb,
lib/evil/client/resolver/middleware.rb,
lib/evil/client/resolver/http_method.rb,
lib/evil/client/exceptions/name_error.rb,
lib/evil/client/exceptions/type_error.rb,
lib/evil/client/exceptions/response_error.rb,
lib/evil/client/exceptions/definition_error.rb,
lib/evil/client/exceptions/validation_error.rb
Overview
Absctract base class for clients to remote APIs
Defined Under Namespace
Modules: Chaining, Connection, Formatter, Names, RSpec Classes: Builder, Container, DefinitionError, NameError, Options, Policy, Resolver, ResponseError, Schema, Settings, TypeError, ValidationError
Instance Attribute Summary collapse
-
#scope ⇒ Evil::Client::Container::Scope
readonly
Initialized root scope container.
Class Method Summary collapse
-
.connection ⇒ #call
Object used as an HTTP(s) connection to remote API.
-
.connection=(connection) ⇒ self
Sets a custom connection, or resets it to a default one.
-
.schema ⇒ Evil::Client::Schema::Scope
Schema for the root scope of the client.
Instance Method Summary collapse
-
#logger ⇒ Logger?
Logger for the root scope.
-
#logger=(logger) ⇒ self
Sets logger to the client.
-
#operations ⇒ Hash<Symbol, Evil::Client::Container::Operation::Builder>
Operations defined at the root of the client.
-
#options ⇒ Hash<Symbol, Object>
Options assigned to the client.
-
#scopes ⇒ Hash<Symbol, Evil::Client::Container::Scope::Builder>
Subscopes of client root.
-
#settings ⇒ Evil::Client::Settings
Settings of the client.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Evil::Client::Chaining
Instance Attribute Details
#scope ⇒ Evil::Client::Container::Scope (readonly)
Initialized root scope container
92 93 94 |
# File 'lib/evil/client.rb', line 92 def scope @scope end |
Class Method Details
.connection ⇒ #call
Object used as an HTTP(s) connection to remote API
It is expected to implement the method [#call] which should take one argument for a rack-compatible request environment, and return a rack-compatible response.
By default the connection is set to [Evil::Client::Connection], but it can be redefined for a custom client.
55 56 57 |
# File 'lib/evil/client.rb', line 55 def connection @connection ||= Evil::Client::Connection end |
.connection=(connection) ⇒ self
Sets a custom connection, or resets it to a default one
64 65 66 67 |
# File 'lib/evil/client.rb', line 64 def connection=(connection) @connection = connection self end |
.schema ⇒ Evil::Client::Schema::Scope
Schema for the root scope of the client
73 74 75 |
# File 'lib/evil/client.rb', line 73 def schema @schema ||= Schema::Scope.new(self) end |
Instance Method Details
#logger ⇒ Logger?
Logger for the root scope
98 99 100 |
# File 'lib/evil/client.rb', line 98 def logger @scope.logger end |
#logger=(logger) ⇒ self
Sets logger to the client
107 108 109 110 |
# File 'lib/evil/client.rb', line 107 def logger=(logger) @scope.logger = logger self end |
#operations ⇒ Hash<Symbol, Evil::Client::Container::Operation::Builder>
Operations defined at the root of the client
116 117 118 |
# File 'lib/evil/client.rb', line 116 def operations @scope.operations end |
#options ⇒ Hash<Symbol, Object>
Options assigned to the client
140 141 142 |
# File 'lib/evil/client.rb', line 140 def @scope. end |
#scopes ⇒ Hash<Symbol, Evil::Client::Container::Scope::Builder>
Subscopes of client root
124 125 126 |
# File 'lib/evil/client.rb', line 124 def scopes @scope.scopes end |
#settings ⇒ Evil::Client::Settings
Settings of the client
132 133 134 |
# File 'lib/evil/client.rb', line 132 def settings @scope.settings end |