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'.freeze
FROM_DATETIME_FORMAT =
'%Y-%m-%dT%H:%M:%S.%N%Z'.freeze

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

from_response, from_response_inflected, #insurances, #to_json

Constructor Details

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

Class Method Details

.build_subscription(name:, id:) ⇒ Object



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

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

Instance Method Details

#add_destination(name:, id:) ⇒ Object



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

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

  return self
end

#set_source(name:, id:) ⇒ Object



30
31
32
33
34
# File 'lib/redox/models/meta.rb', line 30

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

  return self
end