Sha256: 95375119f8dc31ecb08ba9a4ecd34ad817b7fb053a0185a5f72c935b8adf1811

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

require 'time'

module Fog
  module RiakCS
    class Usage < Fog::Service
      requires :riakcs_access_key_id, :riakcs_secret_access_key
      recognizes :host, :path, :port, :scheme, :persistent

      request_path 'fog/riakcs/usage'
      request :get_usage

      class Mock
        include Fog::RiakCS::Utils

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {}
          end
        end

        def self.reset
          @data = nil
        end

        def initialize(options = {})
          configure_uri_options(options)
        end

        def data
          self.class.data[riakcs_uri]
        end

        def reset_data
          self.class.data.delete(riakcs_uri)
        end
      end

      class Real
        include Fog::RiakCS::Utils

        def initialize(options = {})
          configure_uri_options(options)
          @riakcs_access_key_id     = options[:riakcs_access_key_id]
          @riakcs_secret_access_key = options[:riakcs_secret_access_key]
          @connection_options       = options[:connection_options] || {}
          @persistent               = options[:persistent]         || false

          @connection = Fog::Storage.new(
            :provider              => 'AWS',
            :aws_access_key_id     => @riakcs_access_key_id,
            :aws_secret_access_key => @riakcs_secret_access_key,
            :host                  => @host,
            :port                  => @port,
            :scheme                => @scheme,
            :connection_options    => @connection_options
          )
        end
      end
    end
  end
end

Version data entries

6 entries across 4 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-riakcs-0.1.0/lib/fog/riakcs/usage.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-riakcs-0.1.0/lib/fog/riakcs/usage.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-riakcs-0.1.0/lib/fog/riakcs/usage.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-riakcs-0.1.0/lib/fog/riakcs/usage.rb
fog-riakcs-0.1.0 lib/fog/riakcs/usage.rb
fog-riakcs-0.0.1 lib/fog/riakcs/usage.rb