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.
9006 9007 9008 9009 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9006 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__.
9004 9005 9006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9004 def __discriminator__ @__discriminator__ end |
Class Method Details
.from_json(hash) ⇒ Object
9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9019 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
9011 9012 9013 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9011 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
9015 9016 9017 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9015 def to_hash { @__discriminator__ => subtype_to_hash } end |