Class: Worklog::Configuration::GithubConfig

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

Overview

Configuration for Github API access.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ GithubConfig

Initialize with default values, parameters can be overridden via hash

Examples:

GithubConfig.new({'api_key' => '123abc', 'username' => 'sample-user'})


67
68
69
70
71
72
73
# File 'lib/configuration.rb', line 67

def initialize(params = {})
  return if params.nil?

  params.each do |key, value|
    instance_variable_set("@#{key}", value) if respond_to?("#{key}=")
  end
end

Instance Attribute Details

#api_keyString

Returns The API key for Github access.

Returns:

  • (String)

    The API key for Github access.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/configuration.rb', line 61

class GithubConfig
  attr_accessor :api_key, :username

  # Initialize with default values, parameters can be overridden via hash
  # @example
  #   GithubConfig.new({'api_key' => '123abc', 'username' => 'sample-user'})
  def initialize(params = {})
    return if params.nil?

    params.each do |key, value|
      instance_variable_set("@#{key}", value) if respond_to?("#{key}=")
    end
  end
end

#usernameString

Returns The Github username.

Returns:

  • (String)

    The Github username.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/configuration.rb', line 61

class GithubConfig
  attr_accessor :api_key, :username

  # Initialize with default values, parameters can be overridden via hash
  # @example
  #   GithubConfig.new({'api_key' => '123abc', 'username' => 'sample-user'})
  def initialize(params = {})
    return if params.nil?

    params.each do |key, value|
      instance_variable_set("@#{key}", value) if respond_to?("#{key}=")
    end
  end
end