Class: Io::Flow::V0::Clients::PermissionChecks

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PermissionChecks

Returns a new instance of PermissionChecks.



8029
8030
8031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8029

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get_permission_and_checks_and_all_by_organization(organization, incoming = {}) ⇒ Object

Returns permissions for the specified organization for the current request. Used by integrators to test headers.



8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def get_permission_and_checks_and_all_by_organization(organization, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :permitted_method => (x = opts.delete(:permitted_method); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PermittedHttpMethod) ? x : ::Io::Flow::V0::Models::PermittedHttpMethod.apply(x)).value),
    :path => (x = opts.delete(:path); x.nil? ? nil : HttpClient::Preconditions.assert_class('path', x, String))
  }.delete_if { |k, v| v.nil? }
  r = @client.request("/#{CGI.escape(organization)}/permission/checks/all").with_query(query).get
  ::Io::Flow::V0::Models::PermissionCheck.new(r)
end