Class: Fabric::Client
- Inherits:
-
Object
- Object
- Fabric::Client
- Defined in:
- lib/fabric/client.rb
Overview
Gateway Client represents the connection to a Hyperledger Fabric Gateway.
Instance Attribute Summary collapse
-
#default_call_options ⇒ Object
readonly
Returns the value of attribute default_call_options.
-
#grpc_client ⇒ Object
readonly
Returns the value of attribute grpc_client.
Instance Method Summary collapse
-
#chaincode_events(chaincode_events_request, options = {}, &block) ⇒ Object
Subscribe to chaincode events.
-
#commit_status(commit_status_request, options = {}) ⇒ Gateway::CommitStatusResponse
Submits an commit_status_request to the gateway to be evaluted.
-
#endorse(endorse_request, options = {}) ⇒ Gateway::EndorseResponse
Submits an endorse_request to the gateway to be evaluted.
-
#evaluate(evaluate_request, options = {}) ⇒ Gateway::EvaluateResponse
Submits an evaluate_request to the gateway to be evaluted.
-
#initialize(grpc_client: nil, host: nil, creds: nil, default_call_options: {}, **client_opts) ⇒ Client
constructor
Initializes a client.
-
#submit(submit_request, options = {}) ⇒ Gateway::SubmitResponse
Submits an submit_request to the gateway to be evaluted.
Constructor Details
#initialize(grpc_client: client, default_call_options: {}, **client_opts) ⇒ Client #initialize(host: host, creds: creds, default_call_options: {}, **client_opts) ⇒ Client
Initializes a client
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fabric/client.rb', line 42 def initialize(grpc_client: nil, host: nil, creds: nil, default_call_options: {}, **client_opts) if grpc_client init_stub grpc_client elsif host && creds init_grpc_args(host, creds, **client_opts) else raise InvalidArgument, 'Must pass a Gateway::Gateway::Stub or <host>, <creds>, <client_opts>' end () end |
Instance Attribute Details
#default_call_options ⇒ Object (readonly)
Returns the value of attribute default_call_options.
8 9 10 |
# File 'lib/fabric/client.rb', line 8 def @default_call_options end |
#grpc_client ⇒ Object (readonly)
Returns the value of attribute grpc_client.
8 9 10 |
# File 'lib/fabric/client.rb', line 8 def grpc_client @grpc_client end |
Instance Method Details
#chaincode_events(chaincode_events_request) ⇒ Enumerator #chaincode_events(chaincode_events_request) {|event| ... } ⇒ nil #chaincode_events(chaincode_events_request, {return_op: true}) ⇒ GRPC::ActiveCall::Operation #chaincode_events(chaincode_events_request, {return_op: true}) {|event| ... } ⇒ GRPC::ActiveCall::Operation
Subscribe to chaincode events
165 166 167 168 |
# File 'lib/fabric/client.rb', line 165 def chaincode_events(chaincode_events_request, = {}, &block) @grpc_client.chaincode_events(chaincode_events_request, (:chaincode_events, ), &block) end |
#commit_status(commit_status_request, options = {}) ⇒ Gateway::CommitStatusResponse
Submits an commit_status_request to the gateway to be evaluted.
Returns an enum or if you pass a block, use the block.
99 100 101 |
# File 'lib/fabric/client.rb', line 99 def commit_status(commit_status_request, = {}) @grpc_client.commit_status(commit_status_request, (:commit_status, )) end |
#endorse(endorse_request, options = {}) ⇒ Gateway::EndorseResponse
Submits an endorse_request to the gateway to be evaluted.
74 75 76 |
# File 'lib/fabric/client.rb', line 74 def endorse(endorse_request, = {}) @grpc_client.endorse(endorse_request, (:endorse, )) end |
#evaluate(evaluate_request, options = {}) ⇒ Gateway::EvaluateResponse
Submits an evaluate_request to the gateway to be evaluted.
62 63 64 |
# File 'lib/fabric/client.rb', line 62 def evaluate(evaluate_request, = {}) @grpc_client.evaluate(evaluate_request, (:evaluate, )) end |
#submit(submit_request, options = {}) ⇒ Gateway::SubmitResponse
Submits an submit_request to the gateway to be evaluted.
86 87 88 |
# File 'lib/fabric/client.rb', line 86 def submit(submit_request, = {}) @grpc_client.submit(submit_request, (:submit, )) end |