Class: OAuthSignature::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth_signature/config.rb

Overview

Author:

Since:

  • 0.0.1

Version:

  • 0.2

Constant Summary collapse

DEFAULT_CONFIG =

Returns the default configuration options.

Returns:

  • (Hash{Symbol => String|Fixnum})

    the default configuration options

Since:

  • 0.0.1

{
  signature_hash_algorithm: 'SHA256',
  ssh_dir: File.join(ENV['HOME'], '.ssh', 'oauth_signature'),
  ssh_key_size: 8192
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Config

A new instance of Config

Parameters:

  • opts (Hash) (defaults to: {})

    the options to initialize the Config instance with

Options Hash (opts):

  • :orm (Symbol|nil)

    the Config orm

  • :ssh_dir (String)

    the Config ssh_dir

  • :ssh_key_size (Fixnum)

    the Config ssh_key_size

  • :signature_hash_algorithm (String)

    the Config signature_hash_algorithm

  • :use_uuid_for_signer (Boolean|nil)

    the Config use_uuid_for_signer

Since:

  • 0.0.1


35
36
37
38
39
# File 'lib/oauth_signature/config.rb', line 35

def initialize(opts = {})
  DEFAULT_CONFIG.merge(opts).each do |k, val|
    instance_variable_set("@#{k}", val || DEFAULT_CONFIG[k])
  end
end

Instance Attribute Details

#ormSymbol|nil

Returns the orm OAuthSignature will use.

Returns:

  • (Symbol|nil)

    the orm OAuthSignature will use

Since:

  • 0.0.1


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oauth_signature/config.rb', line 17

class Config
  attr_accessor :orm, :signature_hash_algorithm, :ssh_dir, :ssh_key_size, :use_uuid_for_signer

  # @return [Hash{Symbol => String|Fixnum}] the default configuration options
  DEFAULT_CONFIG = {
    signature_hash_algorithm: 'SHA256',
    ssh_dir: File.join(ENV['HOME'], '.ssh', 'oauth_signature'),
    ssh_key_size: 8192
  }.freeze

  # A new instance of Config
  # @param opts [Hash] the options to initialize the Config instance with
  # @option opts [Symbol|nil] :orm the Config orm
  # @option opts [String] :ssh_dir the Config ssh_dir
  # @option opts [Fixnum] :ssh_key_size the Config ssh_key_size
  # @option opts [String] :signature_hash_algorithm the Config signature_hash_algorithm
  # @option opts [Boolean|nil] :use_uuid_for_signer the Config use_uuid_for_signer
  # @return [Config] an instance of Config
  def initialize(opts = {})
    DEFAULT_CONFIG.merge(opts).each do |k, val|
      instance_variable_set("@#{k}", val || DEFAULT_CONFIG[k])
    end
  end
end

#signature_hash_algorithmString

Returns the hashing algorithm used for creating signatures.

Returns:

  • (String)

    the hashing algorithm used for creating signatures

Since:

  • 0.0.1


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oauth_signature/config.rb', line 17

class Config
  attr_accessor :orm, :signature_hash_algorithm, :ssh_dir, :ssh_key_size, :use_uuid_for_signer

  # @return [Hash{Symbol => String|Fixnum}] the default configuration options
  DEFAULT_CONFIG = {
    signature_hash_algorithm: 'SHA256',
    ssh_dir: File.join(ENV['HOME'], '.ssh', 'oauth_signature'),
    ssh_key_size: 8192
  }.freeze

  # A new instance of Config
  # @param opts [Hash] the options to initialize the Config instance with
  # @option opts [Symbol|nil] :orm the Config orm
  # @option opts [String] :ssh_dir the Config ssh_dir
  # @option opts [Fixnum] :ssh_key_size the Config ssh_key_size
  # @option opts [String] :signature_hash_algorithm the Config signature_hash_algorithm
  # @option opts [Boolean|nil] :use_uuid_for_signer the Config use_uuid_for_signer
  # @return [Config] an instance of Config
  def initialize(opts = {})
    DEFAULT_CONFIG.merge(opts).each do |k, val|
      instance_variable_set("@#{k}", val || DEFAULT_CONFIG[k])
    end
  end
end

#ssh_dirString

Returns the ssh directory to persist RSA keys in.

Returns:

  • (String)

    the ssh directory to persist RSA keys in

Since:

  • 0.0.1


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oauth_signature/config.rb', line 17

class Config
  attr_accessor :orm, :signature_hash_algorithm, :ssh_dir, :ssh_key_size, :use_uuid_for_signer

  # @return [Hash{Symbol => String|Fixnum}] the default configuration options
  DEFAULT_CONFIG = {
    signature_hash_algorithm: 'SHA256',
    ssh_dir: File.join(ENV['HOME'], '.ssh', 'oauth_signature'),
    ssh_key_size: 8192
  }.freeze

  # A new instance of Config
  # @param opts [Hash] the options to initialize the Config instance with
  # @option opts [Symbol|nil] :orm the Config orm
  # @option opts [String] :ssh_dir the Config ssh_dir
  # @option opts [Fixnum] :ssh_key_size the Config ssh_key_size
  # @option opts [String] :signature_hash_algorithm the Config signature_hash_algorithm
  # @option opts [Boolean|nil] :use_uuid_for_signer the Config use_uuid_for_signer
  # @return [Config] an instance of Config
  def initialize(opts = {})
    DEFAULT_CONFIG.merge(opts).each do |k, val|
      instance_variable_set("@#{k}", val || DEFAULT_CONFIG[k])
    end
  end
end

#ssh_key_sizeFixnum

Returns the ssh key size in bytes for new RSA keys.

Returns:

  • (Fixnum)

    the ssh key size in bytes for new RSA keys

Since:

  • 0.0.1


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oauth_signature/config.rb', line 17

class Config
  attr_accessor :orm, :signature_hash_algorithm, :ssh_dir, :ssh_key_size, :use_uuid_for_signer

  # @return [Hash{Symbol => String|Fixnum}] the default configuration options
  DEFAULT_CONFIG = {
    signature_hash_algorithm: 'SHA256',
    ssh_dir: File.join(ENV['HOME'], '.ssh', 'oauth_signature'),
    ssh_key_size: 8192
  }.freeze

  # A new instance of Config
  # @param opts [Hash] the options to initialize the Config instance with
  # @option opts [Symbol|nil] :orm the Config orm
  # @option opts [String] :ssh_dir the Config ssh_dir
  # @option opts [Fixnum] :ssh_key_size the Config ssh_key_size
  # @option opts [String] :signature_hash_algorithm the Config signature_hash_algorithm
  # @option opts [Boolean|nil] :use_uuid_for_signer the Config use_uuid_for_signer
  # @return [Config] an instance of Config
  def initialize(opts = {})
    DEFAULT_CONFIG.merge(opts).each do |k, val|
      instance_variable_set("@#{k}", val || DEFAULT_CONFIG[k])
    end
  end
end

#use_uuid_for_signerBoolean|nil

Returns whether or not to use uuid for the signer id for active_record.

Returns:

  • (Boolean|nil)

    whether or not to use uuid for the signer id for active_record

Since:

  • 0.0.1


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oauth_signature/config.rb', line 17

class Config
  attr_accessor :orm, :signature_hash_algorithm, :ssh_dir, :ssh_key_size, :use_uuid_for_signer

  # @return [Hash{Symbol => String|Fixnum}] the default configuration options
  DEFAULT_CONFIG = {
    signature_hash_algorithm: 'SHA256',
    ssh_dir: File.join(ENV['HOME'], '.ssh', 'oauth_signature'),
    ssh_key_size: 8192
  }.freeze

  # A new instance of Config
  # @param opts [Hash] the options to initialize the Config instance with
  # @option opts [Symbol|nil] :orm the Config orm
  # @option opts [String] :ssh_dir the Config ssh_dir
  # @option opts [Fixnum] :ssh_key_size the Config ssh_key_size
  # @option opts [String] :signature_hash_algorithm the Config signature_hash_algorithm
  # @option opts [Boolean|nil] :use_uuid_for_signer the Config use_uuid_for_signer
  # @return [Config] an instance of Config
  def initialize(opts = {})
    DEFAULT_CONFIG.merge(opts).each do |k, val|
      instance_variable_set("@#{k}", val || DEFAULT_CONFIG[k])
    end
  end
end