Class: Reynard

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/reynard.rb,
lib/reynard/http.rb,
lib/reynard/model.rb,
lib/reynard/models.rb,
lib/reynard/schema.rb,
lib/reynard/server.rb,
lib/reynard/context.rb,
lib/reynard/version.rb,
lib/reynard/external.rb,
lib/reynard/template.rb,
lib/reynard/inflector.rb,
lib/reynard/operation.rb,
lib/reynard/media_type.rb,
lib/reynard/http/request.rb,
lib/reynard/http/response.rb,
lib/reynard/specification.rb,
lib/reynard/object_builder.rb,
lib/reynard/request_context.rb,
lib/reynard/serialized_body.rb,
lib/reynard/grouped_parameters.rb,
lib/reynard/schema/model_naming.rb,
lib/reynard/specification/query.rb,
lib/reynard/specification/finder.rb

Overview

Reynard is a convenience class for configuring an HTTP request against an OpenAPI specification.

Defined Under Namespace

Modules: Models Classes: Context, External, GroupedParameters, Http, Inflector, MediaType, Model, ObjectBuilder, Operation, RequestContext, Schema, SerializedBody, Server, Specification, Template

Constant Summary collapse

VERSION =
'0.10.0'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename:) ⇒ Reynard

Returns a new instance of Reynard.



36
37
38
39
# File 'lib/reynard.rb', line 36

def initialize(filename:)
  @specification = Specification.new(filename:)
  @inflector = Inflector.new
end

Class Attribute Details

.httpObject

Returns Reynard’s global request interface. This is a global object to allow persistent connections, caching, and other features that need a persistent object in the process.



55
56
57
58
59
60
61
# File 'lib/reynard.rb', line 55

def self.http
  @http ||= begin
    http = Net::HTTP::Persistent.new(name: 'Reynard')
    http.debug_output = $stderr if ENV['DEBUG']
    http
  end
end

Class Method Details

.user_agentObject

Returns a value that will be used by default for Reynard’s User-Agent headers. Please use the headers setter on the context if you want to change this.



49
50
51
# File 'lib/reynard.rb', line 49

def self.user_agent
  "Reynard/#{Reynard::VERSION}"
end