lib/ngrokapi/models/tunnel_group_backend.rb in ngrok-api-0.18.0 vs lib/ngrokapi/models/tunnel_group_backend.rb in ngrok-api-0.19.0
- old
+ new
@@ -2,40 +2,44 @@
module NgrokAPI
module Models
class TunnelGroupBackend
attr_reader :client,
- :result,
+ :attrs,
:id,
:uri,
:created_at,
:description,
:metadata,
:labels,
:tunnels
- def initialize(client:, result:)
+ def initialize(client: nil, attrs: {})
@client = client
- @result = result
- @id = @result['id']
- @uri = @result['uri']
- @created_at = @result['created_at']
- @description = @result['description']
- @metadata = @result['metadata']
- @labels = @result['labels']
- @tunnels = @result['tunnels']
+ @attrs = attrs
+ @id = @attrs['id']
+ @uri = @attrs['uri']
+ @created_at = @attrs['created_at']
+ @description = @attrs['description']
+ @metadata = @attrs['metadata']
+ @labels = @attrs['labels']
+ @tunnels = @attrs['tunnels']
end
def ==(other)
- @result == other.result
+ @attrs == other.attrs
end
def to_s
- @result.to_s
+ @attrs.to_s
end
+ def to_h
+ @attrs.to_h
+ end
+
##
- # Delete a TunnelGroup backend by ID. TODO what if used?
+ # Delete a TunnelGroup backend by ID.
#
# https://ngrok.com/docs/api#api-tunnel-group-backends-delete
def delete
@client.delete(
id: @id