Class: Io::Flow::V0::Models::FlowRole
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::FlowRole
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
All roles available to attach to a user.
Direct Known Subclasses
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#__discriminator__ ⇒ Object
readonly
Returns the value of attribute discriminator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ FlowRole
constructor
A new instance of FlowRole.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ FlowRole
Returns a new instance of FlowRole.
9477 9478 9479 9480 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9477 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @__discriminator__ = opts[:__discriminator__] ||'flow_role' end |
Instance Attribute Details
#__discriminator__ ⇒ Object (readonly)
Returns the value of attribute discriminator.
9475 9476 9477 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9475 def __discriminator__ @__discriminator__ end |
Class Method Details
.from_json(hash) ⇒ Object
9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9490 def FlowRole.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) hash.map do |union_type_name, data| case union_type_name when Types::FLOW_USER_ROLE; FlowUserRole.new(data) when Types::FLOW_ADDON_ROLE; FlowAddonRole.new(data) else FlowRoleUndefinedType.new(:__discriminator__ => union_type_name) end end.first end |
Instance Method Details
#subtype_to_hash ⇒ Object
9482 9483 9484 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9482 def subtype_to_hash raise 'Cannot serialize an instance of flow_role directly - must use one of the specific types: flow_user_role, flow_addon_role' end |
#to_hash ⇒ Object
9486 9487 9488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9486 def to_hash { @__discriminator__ => subtype_to_hash } end |