Class: Evil::Client
- Inherits:
-
Object
- Object
- Evil::Client
- Includes:
- Chaining
- Defined in:
- lib/evil/client.rb,
lib/evil/client/model.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/dictionary.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
Overview
Absctract base class for clients to remote APIs
Defined Under Namespace
Modules: Chaining, Connection, Dictionary, Formatter, Names, RSpec Classes: Builder, Container, DefinitionError, Model, NameError, Options, Policy, Resolver, ResponseError, Schema, Settings, TypeError
Class Attribute Summary collapse
-
.connection ⇒ #call
Object used as an HTTP(s) connection to remote API.
Instance Attribute Summary collapse
-
#scope ⇒ Evil::Client::Container::Scope
readonly
Initialized root scope container.
Class Method Summary collapse
-
.schema ⇒ Evil::Client::Schema::Scope
Schema for the root scope of the client.
Instance Method Summary collapse
-
#inspect ⇒ String
(also: #to_s, #to_str)
Human-readable representation of the client.
-
#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
Class Attribute 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.
56 57 58 |
# File 'lib/evil/client.rb', line 56 def connection @connection ||= Evil::Client::Connection end |
Instance Attribute Details
#scope ⇒ Evil::Client::Container::Scope (readonly)
Initialized root scope container
89 90 91 |
# File 'lib/evil/client.rb', line 89 def scope @scope end |
Class Method Details
.schema ⇒ Evil::Client::Schema::Scope
Schema for the root scope of the client
70 71 72 |
# File 'lib/evil/client.rb', line 70 def schema @schema ||= Schema::Scope.new(self) end |
Instance Method Details
#inspect ⇒ String Also known as: to_s, to_str
Human-readable representation of the client
144 145 146 147 |
# File 'lib/evil/client.rb', line 144 def inspect vars = .map { |k, v| "@#{k}=#{v}" }.join(", ") "#<#{self.class}:#{format('0x%014x', object_id)} #{vars}>" end |
#logger ⇒ Logger?
Logger for the root scope
95 96 97 |
# File 'lib/evil/client.rb', line 95 def logger @scope.logger end |
#logger=(logger) ⇒ self
Sets logger to the client
104 105 106 |
# File 'lib/evil/client.rb', line 104 def logger=(logger) @scope.logger = logger end |
#operations ⇒ Hash<Symbol, Evil::Client::Container::Operation::Builder>
Operations defined at the root of the client
112 113 114 |
# File 'lib/evil/client.rb', line 112 def operations @scope.operations end |
#options ⇒ Hash<Symbol, Object>
Options assigned to the client
136 137 138 |
# File 'lib/evil/client.rb', line 136 def @scope. end |
#scopes ⇒ Hash<Symbol, Evil::Client::Container::Scope::Builder>
Subscopes of client root
120 121 122 |
# File 'lib/evil/client.rb', line 120 def scopes @scope.scopes end |
#settings ⇒ Evil::Client::Settings
Settings of the client
128 129 130 |
# File 'lib/evil/client.rb', line 128 def settings @scope.settings end |