Sha256: ec97234d8a4e58f9d223fab7b88d68296e2b5d9deef618846db0ac66716e8ad7
Contents?: true
Size: 941 Bytes
Versions: 5
Compression:
Stored size: 941 Bytes
Contents
module ServiceContract module Avro class Protocol < AbstractProtocol def file_path File.join(service.data_dir, "#{name}.avpr") end def endpoints avro.messages.map do |name, message| Endpoint.new(self, message) end end def types avro.types.map do |type| Type.new(type) end end def path File.join(service.path, resource_name) end def main_type # convert protocol name to a class like name. i.e. "city_state" => "CityState" name.split("_").map{|o| o.capitalize}.join end protected def resource_name name.respond_to?(:pluralize) ? name.pluralize : "#{name}s" end def avro @avro ||= begin raise Errors::NotFound unless File.exists?(file_path) ::Avro::Protocol.parse(File.read(file_path)) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems