Sha256: aa8136b42a2f255356078186389ae3563dabff847cec191a06f14332f3dab42a

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

require "faraday"
require "faraday_middleware"

module RubyOctopus
  # Base class to use to perform actions against an Octopus instance.
  class OctopusConnection
    # Users might want to check which domain an instance is targeting.
    attr_reader :url

    def initialize(url, api_key)
      @url = url
      @conn = Faraday.new(
        url: url,
        headers: { "X-Octopus-ApiKey": api_key }
      ) do |faraday|
        faraday.adapter Faraday.default_adapter
        faraday.response :json
      end
    end

    def get(resource_type)
      @conn.get(resource_type)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyoctopus-0.1.0 lib/rubyoctopus/octopusconnection.rb