Sha256: ad1255e9cfb0ae244eccb750f69a263ed553263f20a87997e521ebce6608eca4

Contents?: true

Size: 670 Bytes

Versions: 6

Compression:

Stored size: 670 Bytes

Contents

require_relative 'entity'

module Services
  # This is a service member usually something that
  # would be sitting behind some VIP
  class Member < Services::Entity
    attr_accessor :ip, :port, :proto, :service, :weight
    def initialize(name, args = {})
      @ip = args[:ip] || ''
      @proto = args[:proto] || 'http'
      @port  = args[:port]  || 80
      @weight = args[:weight] || 20
      @service = args[:service]
      @path = "#{service}/members/#{name}"
      super
    end

    private

    def validate
      unless name && @service
        fail ARgumentError,
             "#{self.class} requires name and service argument"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jn_services-1.0.7 lib/services/member.rb
jn_services-1.0.6 lib/services/member.rb
jn_services-1.0.5 lib/services/member.rb
jn_services-1.0.4 lib/services/member.rb
jn_services-1.0.3 lib/services/member.rb
jn_services-1.0.2 lib/services/member.rb