Class: Io::Flow::V0::Models::PermissionError
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PermissionError
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Returned if no permissions are available for a request.
Instance Attribute Summary collapse
-
#admin_users ⇒ Object
readonly
Returns the value of attribute admin_users.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#granting_roles ⇒ Object
readonly
Returns the value of attribute granting_roles.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PermissionError
constructor
A new instance of PermissionError.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PermissionError
Returns a new instance of PermissionError.
39010 39011 39012 39013 39014 39015 39016 39017 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39010 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:code, :messages], 'PermissionError') @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::GenericErrorCode) ? x : ::Io::Flow::V0::Models::GenericErrorCode.apply(x)) @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) } @granting_roles = (x = opts.delete(:granting_roles); x.nil? ? nil : HttpClient::Preconditions.assert_class('granting_roles', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FlowRole) ? x : ::Io::Flow::V0::Models::FlowRole.from_json(x)) }) @admin_users = (x = opts.delete(:admin_users); x.nil? ? nil : HttpClient::Preconditions.assert_class('admin_users', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::User) ? x : ::Io::Flow::V0::Models::User.new(x)) }) end |
Instance Attribute Details
#admin_users ⇒ Object (readonly)
Returns the value of attribute admin_users.
39008 39009 39010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39008 def admin_users @admin_users end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
39008 39009 39010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39008 def code @code end |
#granting_roles ⇒ Object (readonly)
Returns the value of attribute granting_roles.
39008 39009 39010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39008 def granting_roles @granting_roles end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
39008 39009 39010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39008 def @messages end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39023 39024 39025 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39023 def copy(incoming={}) PermissionError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
39027 39028 39029 39030 39031 39032 39033 39034 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39027 def to_hash { :code => code.value, :messages => , :granting_roles => granting_roles.nil? ? nil : granting_roles.map { |o| o.to_hash }, :admin_users => admin_users.nil? ? nil : admin_users.map { |o| o.to_hash } } end |
#to_json ⇒ Object
39019 39020 39021 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39019 def to_json JSON.dump(to_hash) end |