Class: ApiReference::NewBackfill

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/new_backfill.rb

Overview

NewBackfill Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(timeframe_start:, timeframe_end:, replace_existing_events: true, close_time: SKIP, customer_id: SKIP, external_customer_id: SKIP, deprecation_filter: SKIP) ⇒ NewBackfill

Returns a new instance of NewBackfill.



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/api_reference/models/new_backfill.rb', line 88

def initialize(timeframe_start:, timeframe_end:,
               replace_existing_events: true, close_time: SKIP,
               customer_id: SKIP, external_customer_id: SKIP,
               deprecation_filter: SKIP)
  @replace_existing_events = replace_existing_events unless replace_existing_events == SKIP
  @timeframe_start = timeframe_start
  @timeframe_end = timeframe_end
  @close_time = close_time unless close_time == SKIP
  @customer_id = customer_id unless customer_id == SKIP
  @external_customer_id = external_customer_id unless external_customer_id == SKIP
  @deprecation_filter = deprecation_filter unless deprecation_filter == SKIP
end

Instance Attribute Details

#close_timeDateTime

The time at which no more events will be accepted for this backfill. The backfill will automatically begin reflecting throughout Orb at the close time. If not specified, it will default to 1 day after the creation of the backfill.

Returns:

  • (DateTime)


36
37
38
# File 'lib/api_reference/models/new_backfill.rb', line 36

def close_time
  @close_time
end

#customer_idString

The Orb-generated ID of the customer to which this backfill is scoped. Omitting this field will scope the backfill to all customers.

Returns:

  • (String)


41
42
43
# File 'lib/api_reference/models/new_backfill.rb', line 41

def customer_id
  @customer_id
end

#deprecation_filterString

A boolean computed property used to filter the set of events to deprecate

Returns:

  • (String)


52
53
54
# File 'lib/api_reference/models/new_backfill.rb', line 52

def deprecation_filter
  @deprecation_filter
end

#external_customer_idString

The external customer ID of the customer to which this backfill is scoped. Omitting this field will scope the backfill to all customers.

Returns:

  • (String)


46
47
48
# File 'lib/api_reference/models/new_backfill.rb', line 46

def external_customer_id
  @external_customer_id
end

#replace_existing_eventsTrueClass | FalseClass

If true, replaces all existing events in the timeframe with the newly ingested events. If false, adds the newly ingested events to the existing events.

Returns:

  • (TrueClass | FalseClass)


17
18
19
# File 'lib/api_reference/models/new_backfill.rb', line 17

def replace_existing_events
  @replace_existing_events
end

#timeframe_endDateTime

The (exclusive) end of the usage timeframe affected by this backfill. By default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case.

Returns:

  • (DateTime)


29
30
31
# File 'lib/api_reference/models/new_backfill.rb', line 29

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

The (inclusive) start of the usage timeframe affected by this backfill. By default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case.

Returns:

  • (DateTime)


23
24
25
# File 'lib/api_reference/models/new_backfill.rb', line 23

def timeframe_start
  @timeframe_start
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/api_reference/models/new_backfill.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  timeframe_start = if hash.key?('timeframe_start')
                      (DateTimeHelper.from_rfc3339(hash['timeframe_start']) if hash['timeframe_start'])
                    end
  timeframe_end = if hash.key?('timeframe_end')
                    (DateTimeHelper.from_rfc3339(hash['timeframe_end']) if hash['timeframe_end'])
                  end
  replace_existing_events = hash['replace_existing_events'] ||= true
  close_time = if hash.key?('close_time')
                 (DateTimeHelper.from_rfc3339(hash['close_time']) if hash['close_time'])
               else
                 SKIP
               end
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
  external_customer_id =
    hash.key?('external_customer_id') ? hash['external_customer_id'] : SKIP
  deprecation_filter =
    hash.key?('deprecation_filter') ? hash['deprecation_filter'] : SKIP

  # Create object from extracted values.
  NewBackfill.new(timeframe_start: timeframe_start,
                  timeframe_end: timeframe_end,
                  replace_existing_events: replace_existing_events,
                  close_time: close_time,
                  customer_id: customer_id,
                  external_customer_id: external_customer_id,
                  deprecation_filter: deprecation_filter)
end

.namesObject

A mapping from model property names to API property names.



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/api_reference/models/new_backfill.rb', line 55

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['replace_existing_events'] = 'replace_existing_events'
  @_hash['timeframe_start'] = 'timeframe_start'
  @_hash['timeframe_end'] = 'timeframe_end'
  @_hash['close_time'] = 'close_time'
  @_hash['customer_id'] = 'customer_id'
  @_hash['external_customer_id'] = 'external_customer_id'
  @_hash['deprecation_filter'] = 'deprecation_filter'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
82
83
84
85
86
# File 'lib/api_reference/models/new_backfill.rb', line 79

def self.nullables
  %w[
    close_time
    customer_id
    external_customer_id
    deprecation_filter
  ]
end

.optionalsObject

An array for optional fields



68
69
70
71
72
73
74
75
76
# File 'lib/api_reference/models/new_backfill.rb', line 68

def self.optionals
  %w[
    replace_existing_events
    close_time
    customer_id
    external_customer_id
    deprecation_filter
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



156
157
158
159
160
161
162
163
# File 'lib/api_reference/models/new_backfill.rb', line 156

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} replace_existing_events: #{@replace_existing_events.inspect},"\
  " timeframe_start: #{@timeframe_start.inspect}, timeframe_end: #{@timeframe_end.inspect},"\
  " close_time: #{@close_time.inspect}, customer_id: #{@customer_id.inspect},"\
  " external_customer_id: #{@external_customer_id.inspect}, deprecation_filter:"\
  " #{@deprecation_filter.inspect}>"
end

#to_custom_close_timeObject



142
143
144
# File 'lib/api_reference/models/new_backfill.rb', line 142

def to_custom_close_time
  DateTimeHelper.to_rfc3339(close_time)
end

#to_custom_timeframe_endObject



138
139
140
# File 'lib/api_reference/models/new_backfill.rb', line 138

def to_custom_timeframe_end
  DateTimeHelper.to_rfc3339(timeframe_end)
end

#to_custom_timeframe_startObject



134
135
136
# File 'lib/api_reference/models/new_backfill.rb', line 134

def to_custom_timeframe_start
  DateTimeHelper.to_rfc3339(timeframe_start)
end

#to_sObject

Provides a human-readable string representation of the object.



147
148
149
150
151
152
153
# File 'lib/api_reference/models/new_backfill.rb', line 147

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} replace_existing_events: #{@replace_existing_events}, timeframe_start:"\
  " #{@timeframe_start}, timeframe_end: #{@timeframe_end}, close_time: #{@close_time},"\
  " customer_id: #{@customer_id}, external_customer_id: #{@external_customer_id},"\
  " deprecation_filter: #{@deprecation_filter}>"
end