Class: Io::Flow::V0::Models::PermissionError

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Returned if no permissions are available for a request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PermissionError

Returns a new instance of PermissionError.



42534
42535
42536
42537
42538
42539
42540
42541
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42534

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_usersObject (readonly)

Returns the value of attribute admin_users.



42532
42533
42534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42532

def admin_users
  @admin_users
end

#codeObject (readonly)

Returns the value of attribute code.



42532
42533
42534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42532

def code
  @code
end

#granting_rolesObject (readonly)

Returns the value of attribute granting_roles.



42532
42533
42534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42532

def granting_roles
  @granting_roles
end

#messagesObject (readonly)

Returns the value of attribute messages.



42532
42533
42534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42532

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42547
42548
42549
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42547

def copy(incoming={})
  PermissionError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



42551
42552
42553
42554
42555
42556
42557
42558
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42551

def to_hash
  {
    :code => code.value,
    :messages => 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_jsonObject



42543
42544
42545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42543

def to_json
  JSON.dump(to_hash)
end