Class: MockServer::A2A::WebhookTarget Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/mockserver/a2a.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Resolved components of a push-notification webhook URL.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



82
83
84
# File 'lib/mockserver/a2a.rb', line 82

def host
  @host
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



82
83
84
# File 'lib/mockserver/a2a.rb', line 82

def path
  @path
end

#portObject

Returns the value of attribute port

Returns:

  • (Object)

    the current value of port



82
83
84
# File 'lib/mockserver/a2a.rb', line 82

def port
  @port
end

#secureObject

Returns the value of attribute secure

Returns:

  • (Object)

    the current value of secure



82
83
84
# File 'lib/mockserver/a2a.rb', line 82

def secure
  @secure
end

Class Method Details

.parse(url) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


87
88
89
90
91
92
93
94
95
96
97
# File 'lib/mockserver/a2a.rb', line 87

def self.parse(url)
  uri = URI.parse(url)
  secure = uri.scheme.to_s.downcase == 'https'
  host = uri.host
  raise ArgumentError, "Invalid push-notification webhook URL (no host): #{url}" if host.nil? || host.empty?

  port = uri.port || (secure ? 443 : 80)
  path = uri.path
  path = '/' if path.nil? || path.empty?
  new(host, port, secure, path)
end

Instance Method Details

#host_headerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



83
84
85
# File 'lib/mockserver/a2a.rb', line 83

def host_header
  "#{host}:#{port}"
end