Class: Courier::Send::RoutingStrategyChannel
- Inherits:
-
Object
- Object
- Courier::Send::RoutingStrategyChannel
- Defined in:
- lib/trycourier/send/types/routing_strategy_channel.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#if_ ⇒ Object
readonly
Returns the value of attribute if_.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::RoutingStrategyChannel
Deserialize a JSON object to an instance of RoutingStrategyChannel.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(channel:, config: nil, method: nil, providers: nil, if_: nil, additional_properties: nil) ⇒ Send::RoutingStrategyChannel constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of RoutingStrategyChannel to a JSON object.
Constructor Details
#initialize(channel:, config: nil, method: nil, providers: nil, if_: nil, additional_properties: nil) ⇒ Send::RoutingStrategyChannel
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 19 def initialize(channel:, config: nil, method: nil, providers: nil, if_: nil, additional_properties: nil) # @type [String] @channel = channel # @type [Hash{String => String}] @config = config # @type [Send::RoutingMethod] @method = method # @type [Send::MESSAGE_PROVIDERS] @providers = providers # @type [String] @if_ = if_ # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
10 11 12 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 10 def additional_properties @additional_properties end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
10 11 12 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 10 def channel @channel end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 10 def config @config end |
#if_ ⇒ Object (readonly)
Returns the value of attribute if_.
10 11 12 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 10 def if_ @if_ end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
10 11 12 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 10 def method @method end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
10 11 12 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 10 def providers @providers end |
Class Method Details
.from_json(json_object:) ⇒ Send::RoutingStrategyChannel
Deserialize a JSON object to an instance of RoutingStrategyChannel
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 38 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) channel = struct.channel config = struct.config method = struct.method providers = struct.providers if_ = struct.if new(channel: channel, config: config, method: method, providers: providers, if_: if_, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
61 62 63 64 65 66 67 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 61 def self.validate_raw(obj:) obj.channel.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.config&.is_a?(Hash) != false || raise("Passed value for field obj.config is not the expected type, validation failed.") obj.method&.is_a?(Send::RoutingMethod) != false || raise("Passed value for field obj.method is not the expected type, validation failed.") obj.providers&.is_a?(Hash) != false || raise("Passed value for field obj.providers is not the expected type, validation failed.") obj.if_&.is_a?(String) != false || raise("Passed value for field obj.if_ is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of RoutingStrategyChannel to a JSON object
53 54 55 |
# File 'lib/trycourier/send/types/routing_strategy_channel.rb', line 53 def to_json(*_args) { "channel": @channel, "config": @config, "method": @method, "providers": @providers, "if": @if_ }.to_json end |