class NgrokAPI::Models::IPPolicyRule

Attributes

action[R]
attrs[R]
cidr[R]
client[R]
created_at[R]
description[R]
id[R]
ip_policy[R]
metadata[R]
uri[R]

Public Class Methods

new(client: nil, attrs: {}) click to toggle source
# File lib/ngrokapi/models/ip_policy_rule.rb, line 17
def initialize(client: nil, attrs: {})
  @client = client
  @attrs = attrs
  @id = @attrs['id']
  @uri = @attrs['uri']
  @created_at = @attrs['created_at']
  @description = @attrs['description']
  @metadata = @attrs['metadata']
  @cidr = @attrs['cidr']
  @ip_policy = @attrs['ip_policy']
  @action = @attrs['action']
end

Public Instance Methods

==(other) click to toggle source
# File lib/ngrokapi/models/ip_policy_rule.rb, line 30
def ==(other)
  @attrs == other.attrs
end
delete() click to toggle source

Delete an IP policy rule.

ngrok.com/docs/api#api-ip-policy-rules-delete

# File lib/ngrokapi/models/ip_policy_rule.rb, line 46
def delete
  @client.delete(
    id: @id
  )
end
to_h() click to toggle source
# File lib/ngrokapi/models/ip_policy_rule.rb, line 38
def to_h
  @attrs.to_h
end
to_s() click to toggle source
# File lib/ngrokapi/models/ip_policy_rule.rb, line 34
def to_s
  @attrs.to_s
end
update( description: nil, metadata: nil, cidr: nil ) click to toggle source

Update attributes of an IP policy rule by ID

ngrok.com/docs/api#api-ip-policy-rules-update

# File lib/ngrokapi/models/ip_policy_rule.rb, line 56
def update(
  description: nil,
  metadata: nil,
  cidr: nil
)
  @description = description if description
  @metadata = metadata if metadata
  @cidr = cidr if cidr
  @client.update(
    id: @id,
    description: description,
    metadata: metadata,
    cidr: cidr
  )
end