Sha256: 0df75e44ce53b7160b7c8e835e460a13d0db12cdf577c76a5f9b1e74f665de91

Contents?: true

Size: 1.23 KB

Versions: 39

Compression:

Stored size: 1.23 KB

Contents

require "protobuf/nats"

require 'protobuf/message'
require 'protobuf/rpc/service'

module Warehouse

  ##
  # Message Classes
  #
  class Shipment < ::Protobuf::Message; end
  class ShipmentRequest < ::Protobuf::Message; end
  class Shipments < ::Protobuf::Message; end


  ##
  # Message Fields
  #
  class Shipment
    optional :string, :guid, 1
    optional :string, :address, 2
    optional :double, :price, 3
    optional :string, :package_guid, 4
  end

  class ShipmentRequest
    repeated :string, :guid, 1
    repeated :string, :address, 2
    repeated :string, :package_guid, 3
  end

  class Shipments
    repeated ::Warehouse::Shipment, :records, 1
  end


  ##
  # Service Classes
  #
  class ShipmentService < ::Protobuf::Rpc::Service
    rpc :create, ::Warehouse::Shipment, ::Warehouse::Shipment
    rpc :not_implemented, ::Warehouse::Shipment, ::Warehouse::Shipment
    rpc :search, ::Warehouse::ShipmentRequest, ::Warehouse::Shipments

    def create
      respond_with request
    end

    def search
      shipment = ::Warehouse::Shipment.new(:guid => SecureRandom.uuid, :address => "123 LAME ST", :price => 100.0, :package_guid => SecureRandom.uuid)
      respond_with ::Warehouse::Shipments.new(:records => [shipment])
    end
  end

end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
protobuf-nats-0.10.8 examples/warehouse/app.rb
protobuf-nats-0.10.7 examples/warehouse/app.rb
protobuf-nats-0.10.6 examples/warehouse/app.rb
protobuf-nats-0.10.5 examples/warehouse/app.rb
protobuf-nats-0.12.0.pre0 examples/warehouse/app.rb
protobuf-nats-0.10.4 examples/warehouse/app.rb
protobuf-nats-0.10.3 examples/warehouse/app.rb
protobuf-nats-0.10.3.pre0 examples/warehouse/app.rb
protobuf-nats-0.10.2 examples/warehouse/app.rb
protobuf-nats-0.11.0.pre1 examples/warehouse/app.rb
protobuf-nats-0.11.0.pre0 examples/warehouse/app.rb
protobuf-nats-0.10.1 examples/warehouse/app.rb
protobuf-nats-0.10.0 examples/warehouse/app.rb
protobuf-nats-0.9.0 examples/warehouse/app.rb
protobuf-nats-0.9.0.pre3 examples/warehouse/app.rb
protobuf-nats-0.9.0.pre2 examples/warehouse/app.rb
protobuf-nats-0.9.0.pre1 examples/warehouse/app.rb
protobuf-nats-0.8.0 examples/warehouse/app.rb
protobuf-nats-0.7.0 examples/warehouse/app.rb
protobuf-nats-0.7.0.pre1 examples/warehouse/app.rb