Class: DarkPrism::Config::GcloudConfig
- Inherits:
-
Object
- Object
- DarkPrism::Config::GcloudConfig
- Includes:
- Singleton
- Defined in:
- lib/dark_prism/config/gcloud_config.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#pubsub ⇒ Object
readonly
Returns the value of attribute pubsub.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#credentials ⇒ Object
Returns the value of attribute credentials.
8 9 10 |
# File 'lib/dark_prism/config/gcloud_config.rb', line 8 def credentials @credentials end |
#project_id ⇒ Object
Returns the value of attribute project_id.
8 9 10 |
# File 'lib/dark_prism/config/gcloud_config.rb', line 8 def project_id @project_id end |
#pubsub ⇒ Object (readonly)
Returns the value of attribute pubsub.
7 8 9 |
# File 'lib/dark_prism/config/gcloud_config.rb', line 7 def pubsub @pubsub end |
Class Method Details
.configure(&block) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/dark_prism/config/gcloud_config.rb', line 10 def self.configure(&block) raise NoBlockGivenException unless block_given? instance = GcloudConfig.instance instance.instance_eval(&block) instance.prepare_pubsub instance end |
Instance Method Details
#prepare_pubsub ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/dark_prism/config/gcloud_config.rb', line 20 def prepare_pubsub return unless valid? @pubsub = Google::Cloud::Pubsub.new( project: project_id, keyfile: credentials ) end |
#valid? ⇒ Boolean
29 30 31 |
# File 'lib/dark_prism/config/gcloud_config.rb', line 29 def valid? !project_id.nil? && !credentials.nil? end |