Sha256: f9f3db0a64877333569e0a5cc51ea1baad863ade945dfbe31eb5b3f12fea0357

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'luna_park/extensions/injector'
require 'cyclone_lariat/generators/event'
require 'cyclone_lariat/generators/command'
require 'cyclone_lariat/errors'
require 'cyclone_lariat/core'

module CycloneLariat
  module Clients
    class Abstract
      include LunaPark::Extensions::Injector
      include Generators::Event
      include Generators::Command

      dependency(:aws_client_class)      { raise ArgumentError, 'Client class should be defined' }
      dependency(:aws_credentials_class) { Aws::Credentials }

      def initialize(**options)
        @config = CycloneLariat::Options.wrap(options).merge!(CycloneLariat.config)
      end

      attr_reader :config

      def publish
        raise LunaPark::Errors::AbstractMethod, 'Publish method should be defined'
      end

      private

      def aws_client
        @aws_client ||= aws_client_class.new(credentials: aws_credentials, region: config.aws_region)
      end

      def aws_credentials
        @aws_credentials ||= aws_credentials_class.new(config.aws_key, config.aws_secret_key)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cyclone_lariat-1.0.0 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc9 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc8 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc7 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc6 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc5 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc4 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc3 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc2 lib/cyclone_lariat/clients/abstract.rb
cyclone_lariat-1.0.0.rc1 lib/cyclone_lariat/clients/abstract.rb