class Kongfigure::Resources::Service
Attributes
connect_timeout[RW]
host[RW]
name[RW]
path[RW]
port[RW]
protocol[RW]
read_timeout[RW]
retries[RW]
routes[RW]
url[RW]
write_timeout[RW]
Public Class Methods
build(hash)
click to toggle source
# File lib/kongfigure/resources/service.rb, line 7 def self.build(hash) service = new(hash["id"], hash["kongfigure_ignore_fields"]) service.name = hash["name"] service.retries = hash["retries"] service.protocol = hash["protocol"] service.host = hash["host"] service.port = hash["port"] service.path = hash["path"] service.connect_timeout = hash["connect_timeout"] service.write_timeout = hash["write_timeout"] service.read_timeout = hash["read_timeout"] service.plugins = Kongfigure::Resources::Plugin.build_all(hash["plugins"] || []) service.routes = Kongfigure::Resources::Route.build_all(hash["routes"] || []) service.url = hash["url"] || URI::Generic.build({ scheme: hash["protocol"], host: hash["host"], port: hash["port"], path: hash["path"] }).to_s service end
Public Instance Methods
api_attributes()
click to toggle source
# File lib/kongfigure/resources/service.rb, line 49 def api_attributes { "name" => name, "retries" => retries, "protocol" => protocol, "host" => host, "port" => port, "path" => path, "connect_timeout" => connect_timeout, "write_timeout" => write_timeout, "read_timeout" => read_timeout, "url" => url }.compact end
api_name()
click to toggle source
# File lib/kongfigure/resources/service.rb, line 29 def api_name "services" end
has_route?(other_route)
click to toggle source
# File lib/kongfigure/resources/service.rb, line 37 def has_route?(other_route) routes && routes.find do |route| other_route == route end end
has_routes?(other_routes)
click to toggle source
# File lib/kongfigure/resources/service.rb, line 43 def has_routes?(other_routes) other_routes.reject do |other_route| has_route?(other_route) end.size == 0 end
identifier()
click to toggle source
# File lib/kongfigure/resources/service.rb, line 33 def identifier name end
to_s()
click to toggle source
# File lib/kongfigure/resources/service.rb, line 64 def to_s name end