Class: Icss::Message
- Inherits:
-
Object
- Object
- Icss::Message
- Includes:
- Receiver, Receiver::ActsAsHash
- Defined in:
- lib/icss/message.rb,
lib/icss/sample_message_call.rb
Overview
Describes an Avro Message
A message has attributes:
-
doc: an optional description of the message,
-
request: a list of named, typed parameter schemas (this has the same form as the fields of a record declaration);
-
response: a valid schema for the response
-
errors: an optional union of error schemas.
A request parameter list is processed equivalently to an anonymous record. Since record field lists may vary between reader and writer, request parameters may also differ between the caller and responder, and such differences are resolved in the same manner as record field differences.
Instance Attribute Summary collapse
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
- #first_sample_request_param ⇒ Object
- #path ⇒ Object
-
#to_hash ⇒ Object
Conversion.
- #to_json(*args) ⇒ Object
Instance Attribute Details
#protocol ⇒ Object
Returns the value of attribute protocol.
31 32 33 |
# File 'lib/icss/message.rb', line 31 def protocol @protocol end |
Instance Method Details
#first_sample_request_param ⇒ Object
46 47 48 49 |
# File 'lib/icss/message.rb', line 46 def first_sample_request_param req = samples.first.request.first rescue nil req || {} end |
#path ⇒ Object
42 43 44 |
# File 'lib/icss/message.rb', line 42 def path File.join(protocol.path, name) end |
#to_hash ⇒ Object
Conversion
54 55 56 57 58 59 60 61 |
# File 'lib/icss/message.rb', line 54 def to_hash() { :doc => doc, :request => summary_of_request_attr, :response => summary_of_response_attr, :errors => errors, }.reject{|k,v| v.nil? } end |
#to_json(*args) ⇒ Object
62 |
# File 'lib/icss/message.rb', line 62 def to_json(*args) to_hash.to_json(*args) ; end |