Class: Redox::Models::Meta

Inherits:
Model show all
Defined in:
lib/redox/models/meta.rb

Constant Summary collapse

TO_DATETIME_FORMAT =
'%Y-%m-%dT%H:%M:%S.%6NZ'
FROM_DATETIME_FORMAT =
'%Y-%m-%dT%H:%M:%S.%N%Z'

Constants inherited from AbstractModel

AbstractModel::HIGH_LEVEL_KEYS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#initialize, #to_h

Methods inherited from AbstractModel

add_helpers, from_response, from_response_inflected, get_inflected_class, #insurances, #to_json

Constructor Details

This class inherits a constructor from Redox::Models::Model

Class Method Details

.build_subscription(name:, id:) ⇒ Object



39
40
41
42
43
44
# File 'lib/redox/models/meta.rb', line 39

def build_subscription(name:, id:)
  {
    'ID' => id,
    'Name' => name
  }
end

Instance Method Details

#add_destination(name:, id:) ⇒ Object



25
26
27
28
29
30
# File 'lib/redox/models/meta.rb', line 25

def add_destination(name:, id:)
  self[:Destinations] ||= []
  self[:Destinations] << Meta.build_subscription(name: name, id: id)

  self
end

#set_source(name:, id:) ⇒ Object



32
33
34
35
36
# File 'lib/redox/models/meta.rb', line 32

def set_source(name:, id:)
  self[:Source] = Meta.build_subscription(name: name, id: id)

  self
end