Class: DeepSecurity::TimeFilter

Inherits:
TransportObject show all
Defined in:
lib/deepsecurity/transport_objects/time_filter.rb

Overview

Used as search criteria limit the scope of objects returned by time related attributes, such as from, to, or a specific time. If the type is set to EnumTimeFilterType CUSTOM_RANGE, then the rangeFrom and rangeTo property will be required. If the EnumTimeFilterType SPECIFIC_TIME type is set, then the specifiicTime property will be required.

Constant Summary

Constants inherited from SavonHelper::MappingObject

SavonHelper::MappingObject::BLACK_LIST

Instance Attribute Summary collapse

Attributes inherited from SavonHelper::MappingObject

#interface

Attributes included from SavonHelper::DSL

#alias_accessor

High-Level SOAP Wrapper collapse

Methods inherited from TransportObject

#manager

Methods inherited from SavonHelper::CachingObject

all_cache_aspects, #cachable?, #cache, cache_aspects, cache_by_aspect, cache_key, #cache_key, from_savon, #store_in_cache

Methods inherited from SavonHelper::MappingObject

all_type_mappings, defined_attributes, from_savon, has_attribute_chain, #initialize, #to_json, #to_s, #to_savon, type_mappings

Methods included from SavonHelper::DSL

#array_boolean_accessor, #array_datetime_accessor, #array_double_accessor, #array_enum_accessor, #array_float__accessor, #array_integer_accessor, #array_ip_address_accessor, #array_object_accessor, #array_string_accessor, #attr_boolean_accessor, #attr_datetime_accessor, #attr_double_accessor, #attr_enum_accessor, #attr_float_accessor, #attr_integer_accessor, #attr_ip_address_accessor, #attr_object_accessor, #attr_string_accessor, #hint_object_accessor

Constructor Details

This class inherits a constructor from SavonHelper::MappingObject

Instance Attribute Details

#range_fromDateTime

Time range start to filter computers by.

Returns:

  • (DateTime)


8
9
10
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 8

attr_datetime_accessor :rangeFrom,
"Time range start to filter computers by." ,
:range_from

#range_toDateTime

Time range end to filter computers by.

Returns:

  • (DateTime)


11
12
13
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 11

attr_datetime_accessor :rangeTo,
"Time range end to filter computers by.",
:range_to

#specific_timeDateTime

Specific time to filter computers by.

Returns:

  • (DateTime)


14
15
16
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 14

attr_datetime_accessor :specificTime,
"Specific time to filter computers by.",
:specific_time

#typeEnumTimeFilterType

EnumTimeFilterType to filter computers by.

Returns:



20
21
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 20

attr_enum_accessor :type, EnumTimeFilterType,
"EnumTimeFilterType to filter computers by."

Class Method Details

.custom_range(datetime_range) ⇒ TimeFilter

Return a new instance for the given datetime range.

Parameters:

  • datetime_range (Range)

    A range of two datetimes

Returns:



53
54
55
56
57
58
59
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 53

def self.custom_range(datetime_range)
  instance = self.new()
  instance.type = :custom_range
  instance.range_from = datetime_range.first
  instance.range_to = datetime_range.last
  instance
end

.last_24_hoursTimeFilter

Return a new instance for the last 24 hours.

Returns:



35
36
37
38
39
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 35

def self.last_24_hours
  instance = self.new()
  instance.type = :last_24_hours
  instance
end

.last_7_daysTimeFilter

Return a new instance for the last 7 days.

Returns:



44
45
46
47
48
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 44

def self.last_7_days
  instance = self.new()
  instance.type = :last_7_days
  instance
end

.last_dayTimeFilter

Return a new instance for last day (yesterday 00:00:00UTC-23:59:59UTC).

Returns:



82
83
84
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 82

def self.last_day
  self.custom_range(((Date.today-1).to_time)..((Date.today).to_time-1))
end

.last_hourTimeFilter

Return a new instance for the last hour.

Returns:



27
28
29
30
31
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 27

def self.last_hour
  instance = self.new()
  instance.type = :last_hour
  instance
end

.specific_time(datetime) ⇒ TimeFilter

Return a new instance for the given datetime.

Parameters:

  • datetime (DateTime)

Returns:



72
73
74
75
76
77
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 72

def self.specific_time(datetime)
  instance = self.new()
  instance.type = :specific_time
  instance.specific_time = datetime
  instance
end

.specificTime(datetime) ⇒ TimeFilter

Deprecated.

Please use #specific_time instead

Return a new instance for the given datetime.

Parameters:

  • datetime (DateTime)

Returns:



65
66
67
# File 'lib/deepsecurity/transport_objects/time_filter.rb', line 65

def self.specificTime(datetime)
  self.specific_time(datetime)
end