Class: Applitools::BatchInfo
- Inherits:
-
Object
- Object
- Applitools::BatchInfo
- Extended by:
- Helpers
- Defined in:
- lib/applitools/core/batch_info.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#notify_on_completion ⇒ Object
Returns the value of attribute notify_on_completion.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
Instance Method Summary collapse
-
#initialize(args = nil, started_at = Time.now) ⇒ BatchInfo
constructor
A new instance of BatchInfo.
- #json_data ⇒ Object
-
#to_hash ⇒ Object
export type Batch = { id?: string name?: string sequenceName?: string startedAt?: Date | string notifyOnCompletion?: boolean properties?: CustomProperty[] } export type CustomProperty = { name: string value: string }.
- #to_s ⇒ Object
Methods included from Helpers
abstract_attr_accessor, abstract_method, env_variable, environment_attribute, environment_variables
Constructor Details
#initialize(args = nil, started_at = Time.now) ⇒ BatchInfo
Returns a new instance of BatchInfo.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/applitools/core/batch_info.rb', line 20 def initialize(args = nil, started_at = Time.now) case args when String name = args when Hash sym_args = Applitools::Utils.symbolize_keys args id ||= sym_args[:id] name ||= sym_args[:name] properties ||= sym_args[:properties] end self.name = name if name @started_at = started_at if id self.id = id elsif self.id.nil? || self.id.empty? self.id = PROCESS_DEFAULT_BATCH_ID end self.properties = properties if properties unless env_notify_on_completion.nil? self.notify_on_completion = 'true'.casecmp(env_notify_on_completion || '') == 0 ? true : false end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
12 13 14 |
# File 'lib/applitools/core/batch_info.rb', line 12 def id @id end |
#notify_on_completion ⇒ Object
Returns the value of attribute notify_on_completion.
12 13 14 |
# File 'lib/applitools/core/batch_info.rb', line 12 def notify_on_completion @notify_on_completion end |
#properties ⇒ Object
Returns the value of attribute properties.
12 13 14 |
# File 'lib/applitools/core/batch_info.rb', line 12 def properties @properties end |
#started_at ⇒ Object
Returns the value of attribute started_at.
12 13 14 |
# File 'lib/applitools/core/batch_info.rb', line 12 def started_at @started_at end |
Instance Method Details
#json_data ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/applitools/core/batch_info.rb', line 43 def json_data { 'id' => id, 'name' => name, 'startedAt' => @started_at.iso8601, 'batchSequenceName' => sequence_name, 'notifyOnCompletion' => notify_on_completion, 'properties' => properties } end |
#to_hash ⇒ Object
export type Batch =
id?: string
name?: string
sequenceName?: string
startedAt?: Date | string
notifyOnCompletion?: boolean
properties?: CustomProperty[]
export type CustomProperty =
name: string
value: string
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/applitools/core/batch_info.rb', line 66 def to_hash { id: id, name: name, # 'Ruby Coverage Tests', startedAt: @started_at.iso8601, sequenceName: sequence_name, notifyOnCompletion: notify_on_completion, properties: properties }.compact end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/applitools/core/batch_info.rb', line 77 def to_s to_hash.to_s end |