Class: NgrokAPI::Models::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/models/endpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: nil, attrs: {}) ⇒ Endpoint

Returns a new instance of Endpoint.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ngrokapi/models/endpoint.rb', line 40

def initialize(client: nil, attrs: {})
  @client = client
  @attrs = attrs
  @id = @attrs['id']
  @region = @attrs['region']
  @created_at = @attrs['created_at']
  @updated_at = @attrs['updated_at']
  unless @attrs['public_url'].nil?
    @public_url = URI(@attrs['public_url'])
  end
  @proto = @attrs['proto']
  @scheme = @attrs['scheme']
  @hostport = @attrs['hostport']
  @host = @attrs['host']
  @port = @attrs['port']
  @type = @attrs['type']
  @metadata = @attrs['metadata']
  @description = @attrs['description']
  @domain = @attrs['domain']
  @tcp_addr = @attrs['tcp_addr']
  @tunnel = @attrs['tunnel']
  @edge = @attrs['edge']
  @upstream_url = @attrs['upstream_url']
  @upstream_proto = @attrs['upstream_proto']
  @url = @attrs['url']
  @principal = @attrs['principal']
  @principal_id = @attrs['principal_id']
  @traffic_policy = @attrs['traffic_policy']
  @bindings = @attrs['bindings']
  @tunnel_session = @attrs['tunnel_session']
  unless @attrs['uri'].nil?
    @uri = URI(@attrs['uri'])
  end
  @name = @attrs['name']
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def attrs
  @attrs
end

#bindingsObject (readonly)

Returns the value of attribute bindings.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def bindings
  @bindings
end

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def client
  @client
end

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def description
  @description
end

#domainObject (readonly)

Returns the value of attribute domain.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def domain
  @domain
end

#edgeObject (readonly)

Returns the value of attribute edge.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def edge
  @edge
end

#hostObject (readonly)

Returns the value of attribute host.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def host
  @host
end

#hostportObject (readonly)

Returns the value of attribute hostport.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def hostport
  @hostport
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def name
  @name
end

#portObject (readonly)

Returns the value of attribute port.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def port
  @port
end

#principalObject (readonly)

Returns the value of attribute principal.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def principal
  @principal
end

#principal_idObject (readonly)

Returns the value of attribute principal_id.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def principal_id
  @principal_id
end

#protoObject (readonly)

Returns the value of attribute proto.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def proto
  @proto
end

#public_urlObject (readonly)

Returns the value of attribute public_url.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def public_url
  @public_url
end

#regionObject (readonly)

Returns the value of attribute region.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def region
  @region
end

#schemeObject (readonly)

Returns the value of attribute scheme.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def scheme
  @scheme
end

#tcp_addrObject (readonly)

Returns the value of attribute tcp_addr.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def tcp_addr
  @tcp_addr
end

#traffic_policyObject (readonly)

Returns the value of attribute traffic_policy.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def traffic_policy
  @traffic_policy
end

#tunnelObject (readonly)

Returns the value of attribute tunnel.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def tunnel
  @tunnel
end

#tunnel_sessionObject (readonly)

Returns the value of attribute tunnel_session.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def tunnel_session
  @tunnel_session
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def updated_at
  @updated_at
end

#upstream_protoObject (readonly)

Returns the value of attribute upstream_proto.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def upstream_proto
  @upstream_proto
end

#upstream_urlObject (readonly)

Returns the value of attribute upstream_url.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def upstream_url
  @upstream_url
end

#uriObject (readonly)

Returns the value of attribute uri.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def uri
  @uri
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/ngrokapi/models/endpoint.rb', line 10

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



76
77
78
# File 'lib/ngrokapi/models/endpoint.rb', line 76

def ==(other)
  @attrs == other.attrs
end

#deleteObject

Delete an Endpoint by ID, currently available only for cloud endpoints

https://ngrok.com/docs/api#api-endpoints-delete



118
119
120
121
122
# File 'lib/ngrokapi/models/endpoint.rb', line 118

def delete
  @client.delete(
    id: @id
  )
end

#to_hObject



84
85
86
# File 'lib/ngrokapi/models/endpoint.rb', line 84

def to_h
  @attrs.to_h
end

#to_sObject



80
81
82
# File 'lib/ngrokapi/models/endpoint.rb', line 80

def to_s
  @attrs.to_s
end

#update(url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil) ⇒ Object

Update an Endpoint by ID, currently available only for cloud endpoints

https://ngrok.com/docs/api#api-endpoints-update



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/ngrokapi/models/endpoint.rb', line 92

def update(
  url: nil,
  traffic_policy: nil,
  description: nil,
  metadata: nil,
  bindings: nil
)
  @url = url if url
  @traffic_policy = traffic_policy if traffic_policy
  @description = description if description
  @metadata =  if 
  @bindings = bindings if bindings
  @client.update(
    id: @id,
    url: url,
    traffic_policy: traffic_policy,
    description: description,
    metadata: ,
    bindings: bindings
  )
end