Class: Svix::GoogleCloudStorageConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/google_cloud_storage_config.rb

Overview

Configuration for a Google Cloud Storage sink.

Write stream events into the named bucket using the supplied Google Cloud credentials.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GoogleCloudStorageConfig

Returns a new instance of GoogleCloudStorageConfig.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/svix/models/google_cloud_storage_config.rb', line 17

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(
      ArgumentError,
      "The input argument (attributes) must be a hash in `Svix::GoogleCloudStorageConfig` new method"
    )
  end

  attributes.each do |k, v|
    unless ALL_FIELD.include?(k.to_s)
      fail(ArgumentError, "The field #{k} is not part of Svix::GoogleCloudStorageConfig")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#bucketObject

Returns the value of attribute bucket.



10
11
12
# File 'lib/svix/models/google_cloud_storage_config.rb', line 10

def bucket
  @bucket
end

#credentialsObject

Google Cloud Credentials JSON Object as a string.



12
13
14
# File 'lib/svix/models/google_cloud_storage_config.rb', line 12

def credentials
  @credentials
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/svix/models/google_cloud_storage_config.rb', line 35

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["bucket"] = attributes["bucket"]
  attrs["credentials"] = attributes["credentials"]
  new(attrs)
end

Instance Method Details

#serializeObject



43
44
45
46
47
48
# File 'lib/svix/models/google_cloud_storage_config.rb', line 43

def serialize
  out = Hash.new
  out["bucket"] = Svix::serialize_primitive(@bucket) if @bucket
  out["credentials"] = Svix::serialize_primitive(@credentials) if @credentials
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



52
53
54
# File 'lib/svix/models/google_cloud_storage_config.rb', line 52

def to_json
  JSON.dump(serialize)
end