Class: Io::Flow::V0::Models::PermissionCheck
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PermissionCheck
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Used to test an integration’s permissions, including identifying the authentication technique that will be used for similar requests.
Instance Attribute Summary collapse
-
#authentication_technique ⇒ Object
readonly
Returns the value of attribute authentication_technique.
-
#behaviors ⇒ Object
readonly
Returns the value of attribute behaviors.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PermissionCheck
constructor
A new instance of PermissionCheck.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PermissionCheck
Returns a new instance of PermissionCheck.
43905 43906 43907 43908 43909 43910 43911 43912 43913 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43905 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:authentication_technique, :roles, :behaviors, :routes], 'PermissionCheck') @authentication_technique = (x = opts.delete(:authentication_technique); x.is_a?(::Io::Flow::V0::Models::AuthenticationTechnique) ? x : ::Io::Flow::V0::Models::AuthenticationTechnique.apply(x)) @user = (x = opts.delete(:user); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExpandableUser) ? x : ::Io::Flow::V0::Models::ExpandableUser.from_json(x))) @roles = HttpClient::Preconditions.assert_class('roles', opts.delete(:roles), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FlowRole) ? x : ::Io::Flow::V0::Models::FlowRole.apply(x)) } @behaviors = HttpClient::Preconditions.assert_class('behaviors', opts.delete(:behaviors), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FlowBehavior) ? x : ::Io::Flow::V0::Models::FlowBehavior.apply(x)) } @routes = HttpClient::Preconditions.assert_class('routes', opts.delete(:routes), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PermittedRoute) ? x : ::Io::Flow::V0::Models::PermittedRoute.new(x)) } end |
Instance Attribute Details
#authentication_technique ⇒ Object (readonly)
Returns the value of attribute authentication_technique.
43903 43904 43905 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43903 def authentication_technique @authentication_technique end |
#behaviors ⇒ Object (readonly)
Returns the value of attribute behaviors.
43903 43904 43905 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43903 def behaviors @behaviors end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
43903 43904 43905 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43903 def roles @roles end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
43903 43904 43905 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43903 def routes @routes end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
43903 43904 43905 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43903 def user @user end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
43919 43920 43921 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43919 def copy(incoming={}) PermissionCheck.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
43923 43924 43925 43926 43927 43928 43929 43930 43931 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43923 def to_hash { :authentication_technique => authentication_technique.value, :user => user.nil? ? nil : user.to_hash, :roles => roles.map { |o| o.value }, :behaviors => behaviors.map { |o| o.value }, :routes => routes.map { |o| o.to_hash } } end |
#to_json ⇒ Object
43915 43916 43917 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43915 def to_json JSON.dump(to_hash) end |