Class: Files::AgentProxyIdentity

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/agent_proxy_identity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ AgentProxyIdentity

Returns a new instance of AgentProxyIdentity.



7
8
9
10
# File 'lib/files.com/models/agent_proxy_identity.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/agent_proxy_identity.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/agent_proxy_identity.rb', line 5

def options
  @options
end

Class Method Details

.lookup(params = {}, options = {}) ⇒ Object

Parameters:

ips (required) - array(string) - One or more public IPv4 addresses to resolve


24
25
26
27
28
29
30
31
32
# File 'lib/files.com/models/agent_proxy_identity.rb', line 24

def self.lookup(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: ips must be an Array") if params[:ips] and !params[:ips].is_a?(Array)
  raise MissingParameterError.new("Parameter missing: ips") unless params[:ips]

  response, options = Api.send_request("/agent_proxy_identities/lookup", :post, params, options)
  response.data.map do |entity_data|
    AgentProxyIdentityResult.new(entity_data, options)
  end
end

.report(params = {}, options = {}) ⇒ Object

Parameters:

private_ip (required) - string - Proxy private IPv4 address
peer_id (required) - string - Libp2p peer ID currently served by the proxy


37
38
39
40
41
42
43
44
45
# File 'lib/files.com/models/agent_proxy_identity.rb', line 37

def self.report(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: private_ip must be an String") if params[:private_ip] and !params[:private_ip].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: peer_id must be an String") if params[:peer_id] and !params[:peer_id].is_a?(String)
  raise MissingParameterError.new("Parameter missing: private_ip") unless params[:private_ip]
  raise MissingParameterError.new("Parameter missing: peer_id") unless params[:peer_id]

  Api.send_request("/agent_proxy_identities/report", :post, params, options)
  nil
end

Instance Method Details

#endpointsObject

array(object) - Protocol-specific endpoints for this peer ID.



18
19
20
# File 'lib/files.com/models/agent_proxy_identity.rb', line 18

def endpoints
  @attributes[:endpoints]
end

#peer_idObject

string - Libp2p peer ID for this identity candidate.



13
14
15
# File 'lib/files.com/models/agent_proxy_identity.rb', line 13

def peer_id
  @attributes[:peer_id]
end