Class: Setka::Workflow::Configuration

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

Constant Summary collapse

CONFIGURABLE_ATTRIBUTES =
[
  :access_token,
  :space_name
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Configuration

Returns a new instance of Configuration.



15
16
17
# File 'lib/setka/workflow/configuration.rb', line 15

def initialize(attrs = {})
  self.attributes = attrs
end

Class Method Details

.configurable_attributesObject



11
12
13
# File 'lib/setka/workflow/configuration.rb', line 11

def self.configurable_attributes
  CONFIGURABLE_ATTRIBUTES
end

Instance Method Details

#access_token=(value) ⇒ Object



29
30
31
32
33
# File 'lib/setka/workflow/configuration.rb', line 29

def access_token=(value)
  validate_string_value(:access_token, value)

  @access_token = value
end

#attributes=(attrs = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/setka/workflow/configuration.rb', line 19

def attributes=(attrs = {})
  attrs.each do |key, value|
    if CONFIGURABLE_ATTRIBUTES.include?(key)
      validate_string_value(key, value)

      instance_variable_set("@#{key}", value)
    end
  end
end

#credentialsObject



41
42
43
# File 'lib/setka/workflow/configuration.rb', line 41

def credentials
  { access_token: access_token, space_name: space_name }
end

#credentials?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/setka/workflow/configuration.rb', line 45

def credentials?
  validate_credentials_presence
end

#space_name=(value) ⇒ Object



35
36
37
38
39
# File 'lib/setka/workflow/configuration.rb', line 35

def space_name=(value)
  validate_string_value(:space_name, value)

  @space_name = value
end