Module: ProtoPharm

Extended by:
Api
Includes:
Directive::ConfigDelegation
Defined in:
lib/proto_pharm/metadata_serializers/gruf.rb,
lib/proto_pharm.rb,
lib/proto_pharm/api.rb,
lib/proto_pharm/errors.rb,
lib/proto_pharm/adapter.rb,
lib/proto_pharm/version.rb,
lib/proto_pharm/response.rb,
lib/proto_pharm/rspec/dsl.rb,
lib/proto_pharm/action_stub.rb,
lib/proto_pharm/request_stub.rb,
lib/proto_pharm/configuration.rb,
lib/proto_pharm/introspection.rb,
lib/proto_pharm/stub_registry.rb,
lib/proto_pharm/operation_stub.rb,
lib/proto_pharm/request_pattern.rb,
lib/proto_pharm/grpc_stub_adapter.rb,
lib/proto_pharm/response_sequence.rb,
lib/proto_pharm/rspec/action_stub_proxy.rb,
lib/proto_pharm/metadata_serializers/base.rb,
lib/proto_pharm/rspec/action_stub_builder.rb,
lib/proto_pharm/grpc_stub_adapter/mock_stub.rb,
lib/proto_pharm/introspection/rpc_inspector.rb,
lib/proto_pharm/metadata_serializers/freshly.rb,
lib/proto_pharm/introspection/service_resolver.rb,
lib/proto_pharm/matchers/hash_argument_matcher.rb,
lib/proto_pharm/rspec/matchers/have_received_rpc.rb,
lib/proto_pharm/stub_components/failure_response.rb,
lib/proto_pharm/matchers/request_including_matcher.rb

Overview

Serializes metadata for an application’s Gruf configuration.

Usage:

Configuration.configure { |c| c.metadata_serializer = ProtoPharm::MetadataSerializers::Gruf }

allow_grpc_service(AService)
  .to receive_rpc(:your_endpoint)
  .and_fail_with(
    code: :invalid_argument,
    app_code: :cant_let_you_do_that_star_fox
    metadata: { some: :meta }
  )

begin

Service.your_endpoint

rescue Gruf::Client::Error::InvalidArgument => e

e.error

Defined Under Namespace

Modules: Api, Configuration, Introspection, Matchers, MetadataSerializers, RSpec, Response, StubComponents Classes: ActionStub, Adapter, Error, GrpcStubAdapter, InvalidProtoType, NetConnectNotAllowedError, NoResponseError, OperationStub, RequestPattern, RequestStub, ResponsesSequence, RpcNotFoundError, RpcNotStubbedError, StubRegistry

Constant Summary collapse

VERSION =
"0.7.0"

Class Method Summary collapse

Methods included from Api

allow_net_connect!, allow_net_connect?, disable_net_connect!, request_including, stub_grpc_action, stub_request

Class Method Details

.adapterObject



44
45
46
# File 'lib/proto_pharm.rb', line 44

def adapter
  @adapter ||= Adapter.new
end

.reset!Object



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

def reset!
  ProtoPharm.stub_registry.reset!
end

.stub_registryObject



40
41
42
# File 'lib/proto_pharm.rb', line 40

def stub_registry
  @stub_registry ||= ProtoPharm::StubRegistry.new
end