Class: Newshound::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/newshound/configuration.rb', line 10

def initialize
  @slack_webhook_url = nil
  @slack_channel = "#general"
  @report_time = "09:00"
  @exception_limit = 4
  @time_zone = "America/New_York"
  @enabled = true
  @transport_adapter = :slack
  @sns_topic_arn = nil
  @aws_region = nil
  @aws_access_key_id = nil
  @aws_secret_access_key = nil
end

Instance Attribute Details

#aws_access_key_idObject

Returns the value of attribute aws_access_key_id.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def aws_access_key_id
  @aws_access_key_id
end

#aws_regionObject

Returns the value of attribute aws_region.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def aws_region
  @aws_region
end

#aws_secret_access_keyObject

Returns the value of attribute aws_secret_access_key.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def aws_secret_access_key
  @aws_secret_access_key
end

#enabledObject

Returns the value of attribute enabled.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def enabled
  @enabled
end

#exception_limitObject

Returns the value of attribute exception_limit.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def exception_limit
  @exception_limit
end

#report_timeObject

Returns the value of attribute report_time.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def report_time
  @report_time
end

#slack_channelObject

Returns the value of attribute slack_channel.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def slack_channel
  @slack_channel
end

#slack_webhook_urlObject

Returns the value of attribute slack_webhook_url.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def slack_webhook_url
  @slack_webhook_url
end

#sns_topic_arnObject

Returns the value of attribute sns_topic_arn.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def sns_topic_arn
  @sns_topic_arn
end

#time_zoneObject

Returns the value of attribute time_zone.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def time_zone
  @time_zone
end

#transport_adapterObject

Returns the value of attribute transport_adapter.



5
6
7
# File 'lib/newshound/configuration.rb', line 5

def transport_adapter
  @transport_adapter
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/newshound/configuration.rb', line 24

def valid?
  return false unless enabled
  return false if slack_webhook_url.nil? || slack_webhook_url.empty?
  
  true
end