Class: Comet::S3DestinationLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/s3destination_location.rb

Overview

S3DestinationLocation is a typed class wrapper around the underlying Comet Server API data structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeS3DestinationLocation

Returns a new instance of S3DestinationLocation.



41
42
43
# File 'lib/comet/models/s3destination_location.rb', line 41

def initialize
  clear
end

Instance Attribute Details

#s3access_keyObject

Returns the value of attribute s3access_key.



24
25
26
# File 'lib/comet/models/s3destination_location.rb', line 24

def s3access_key
  @s3access_key
end

#s3bucket_nameObject

Returns the value of attribute s3bucket_name.



30
31
32
# File 'lib/comet/models/s3destination_location.rb', line 30

def s3bucket_name
  @s3bucket_name
end

#s3secret_keyObject

Returns the value of attribute s3secret_key.



27
28
29
# File 'lib/comet/models/s3destination_location.rb', line 27

def s3secret_key
  @s3secret_key
end

#s3serverObject

Returns the value of attribute s3server.



18
19
20
# File 'lib/comet/models/s3destination_location.rb', line 18

def s3server
  @s3server
end

#s3subdirObject

Returns the value of attribute s3subdir.



33
34
35
# File 'lib/comet/models/s3destination_location.rb', line 33

def s3subdir
  @s3subdir
end

#s3uses_tlsObject

Returns the value of attribute s3uses_tls.



21
22
23
# File 'lib/comet/models/s3destination_location.rb', line 21

def s3uses_tls
  @s3uses_tls
end

#s3uses_v2signingObject

Returns the value of attribute s3uses_v2signing.



36
37
38
# File 'lib/comet/models/s3destination_location.rb', line 36

def s3uses_v2signing
  @s3uses_v2signing
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



39
40
41
# File 'lib/comet/models/s3destination_location.rb', line 39

def unknown_json_fields
  @unknown_json_fields
end

Instance Method Details

#clearObject



45
46
47
48
49
50
51
52
# File 'lib/comet/models/s3destination_location.rb', line 45

def clear
  @s3server = ''
  @s3access_key = ''
  @s3secret_key = ''
  @s3bucket_name = ''
  @s3subdir = ''
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/comet/models/s3destination_location.rb', line 62

def from_hash(obj)
  raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash

  obj.each do |k, v|
    case k
    when 'S3Server'
      raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String

      @s3server = v
    when 'S3UsesTLS'
      @s3uses_tls = v
    when 'S3AccessKey'
      raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String

      @s3access_key = v
    when 'S3SecretKey'
      raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String

      @s3secret_key = v
    when 'S3BucketName'
      raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String

      @s3bucket_name = v
    when 'S3Subdir'
      raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String

      @s3subdir = v
    when 'S3UsesV2Signing'
      @s3uses_v2signing = v
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format



55
56
57
58
59
# File 'lib/comet/models/s3destination_location.rb', line 55

def from_json(json_string)
  raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String

  from_hash(JSON.parse(json_string))
end

#to_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



114
115
116
# File 'lib/comet/models/s3destination_location.rb', line 114

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/comet/models/s3destination_location.rb', line 98

def to_hash
  ret = {}
  ret['S3Server'] = @s3server
  ret['S3UsesTLS'] = @s3uses_tls
  ret['S3AccessKey'] = @s3access_key
  ret['S3SecretKey'] = @s3secret_key
  ret['S3BucketName'] = @s3bucket_name
  ret['S3Subdir'] = @s3subdir
  ret['S3UsesV2Signing'] = @s3uses_v2signing
  @unknown_json_fields.each do |k, v|
    ret[k] = v
  end
  ret
end

#to_json(options = {}) ⇒ String

Returns The complete object as a JSON string.

Returns:

  • (String)

    The complete object as a JSON string



119
120
121
# File 'lib/comet/models/s3destination_location.rb', line 119

def to_json(options = {})
  to_hash.to_json(options)
end