Module: Atomsphere

Defined in:
lib/atomsphere.rb,
lib/atomsphere/api.rb,
lib/atomsphere/query.rb,
lib/atomsphere/action.rb,
lib/atomsphere/api/client.rb,
lib/atomsphere/api/response.rb,
lib/atomsphere/configuration.rb,
lib/atomsphere/query/builder.rb,
lib/atomsphere/query/expression.rb,
lib/atomsphere/query/builder/group.rb,
lib/atomsphere/action/execute_process.rb,
lib/atomsphere/query/builder/property.rb,
lib/atomsphere/action/get_assignable_roles.rb,
lib/atomsphere/action/change_listener_status.rb,
lib/atomsphere/query/expression/simple_expression.rb,
lib/atomsphere/query/expression/grouping_expression.rb

Overview

Author:

  • Warren Guy

Defined Under Namespace

Modules: Action, Api Classes: Configuration, Query

Constant Summary collapse

VERSION =
'0.1.11'
ROOT =
"#{File.expand_path(__dir__)}/atomsphere"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



15
16
17
# File 'lib/atomsphere/configuration.rb', line 15

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



18
19
20
21
22
23
# File 'lib/atomsphere/configuration.rb', line 18

def self.configure
  self.configuration ||= Configuration.new
  yield configuration

  configuration
end

.query(object_type = nil, &block) ⇒ Object

Invoke the DSL for constructing an Query

Examples:

without an expression, returns all possible results

Atomsphere.query(:process)

a simple query expression for online Atoms

Atomsphere.query(:atom) { status.equals :online }

a query expression for online cloud Atoms (implied ‘and` group)

Atomsphere.query(:atom) do
  status.equals :online
  type.equals :cloud
end

a more complex example with nested group expressions

Atomsphere.query(:atom) do
  group :or do
    date_installed.less_than '2018-12-01T00:00:00Z'
    group :and do
      status.not_equals :online
      type.not_equals :cloud
    end
  end
end


64
65
66
67
68
69
# File 'lib/atomsphere/query/builder.rb', line 64

def self.query(object_type=nil, &block)
  q = Query::Builder.new(object_type)
  q.instance_eval(&block) if block_given?

  q.query
end