Class: Io::Flow::V0::Models::SimplePermissionCheck

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

Overview

A simple model, used to convey permitted behaviors along with approval of a request for a specific permitted route.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ SimplePermissionCheck

Returns a new instance of SimplePermissionCheck.



63497
63498
63499
63500
63501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63497

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:behaviors], 'SimplePermissionCheck')
  @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)) }
end

Instance Attribute Details

#behaviorsObject (readonly)

Returns the value of attribute behaviors.



63495
63496
63497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63495

def behaviors
  @behaviors
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



63507
63508
63509
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63507

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

#to_hashObject



63511
63512
63513
63514
63515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63511

def to_hash
  {
    :behaviors => behaviors.map { |o| o.value }
  }
end

#to_jsonObject



63503
63504
63505
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63503

def to_json
  JSON.dump(to_hash)
end