Sha256: 9e8b87f27430471cffea90cf8b1018ad302b42e428d4b6b113ee2bf5c15f9ed4

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

# Code generated for API Clients. DO NOT EDIT.

require 'uri'

module NgrokAPI
  module Models
    class BotUser
      attr_reader :client,
        :attrs,
        :id,
        :uri,
        :name,
        :active,
        :created_at

      def initialize(client: nil, attrs: {})
        @client = client
        @attrs = attrs
        @id = @attrs['id']
        unless @attrs['uri'].nil?
          @uri = URI(@attrs['uri'])
        end
        @name = @attrs['name']
        @active = @attrs['active']
        @created_at = @attrs['created_at']
      end

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

      def to_s
        @attrs.to_s
      end

      def to_h
        @attrs.to_h
      end

      ##
      # Delete a bot user by ID
      #
      # https://ngrok.com/docs/api#api-bot-users-delete
      def delete
        @client.delete(
          id: @id
        )
      end

      ##
      # Update attributes of a bot user by ID.
      #
      # https://ngrok.com/docs/api#api-bot-users-update
      def update(
        name: nil,
        active: nil
      )
        @name = name if name
        @active = active if active
        @client.update(
          id: @id,
          name: name,
          active: active
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ngrok-api-0.24.0 lib/ngrokapi/models/bot_user.rb
ngrok-api-0.23.0 lib/ngrokapi/models/bot_user.rb
ngrok-api-0.22.0 lib/ngrokapi/models/bot_user.rb