Sha256: 7b70896bb804f1ad5feffaae390f82a764703cc12fa06f9e1fde9fbbc5fef8e8

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

# Create a client to log DEV interactions in your Orbit workspace
# Credentials can either be passed in to the instance or be loaded
# from environment variables
#
# @example
#   client = DevOrbit::Client.new
#
# @option params [String] :dev_username
#   The username of the person or organization to fetch DEV interactions for
#
# @option params [String] :dev_api_key
#   The API key for the DEV API
#
# @option params [String] :orbit_workspace
#   The workspace ID for the Orbit workspace
#
# @option params [String] :orbit_api_key
#   The API key for the Orbit API
#
# @param [Hash] params
#
# @return [DevOrbit::Client]
#
module DevOrbit
  class Client
    attr_accessor :dev_username, :dev_api_key, :orbit_workspace, :orbit_api_key

    def initialize(params = {})
      @orbit_api_key = params.fetch(:orbit_api_key, ENV["ORBIT_API_KEY"])
      @orbit_workspace = params.fetch(:orbit_workspace, ENV["ORBIT_WORKSPACE"])
      @dev_api_key = params.fetch(:dev_api_key, ENV["DEV_API_KEY"])
      @dev_username = params.fetch(:dev_username, ENV["DEV_USERNAME"])
    end

    # Fetch new comments from DEV and post them to the Orbit workspace
    def comments
      DevOrbit::Dev.new(
        api_key: @dev_api_key,
        username: @dev_username,
        workspace_id: @orbit_workspace,
        orbit_api_key: @orbit_api_key
      ).process_comments
    end

    def orbit
      DevOrbit::Orbit.new
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dev_orbit-0.0.5 lib/dev_orbit/client.rb
dev_orbit-0.0.4 lib/dev_orbit/client.rb
dev_orbit-0.0.3 lib/dev_orbit/client.rb
dev_orbit-0.0.2 lib/dev_orbit/client.rb
dev_orbit-0.0.1 lib/dev_orbit/client.rb