Class: ProcessOut::NativeAPMRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/native_apm_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ NativeAPMRequest

Initializes the NativeAPMRequest object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



39
40
41
42
43
44
# File 'lib/processout/native_apm_request.rb', line 39

def initialize(client, data = {})
  @client = client

  self.parameter_values = data.fetch(:parameter_values, nil)
  
end

Instance Attribute Details

#parameter_valuesObject

Returns the value of attribute parameter_values.



11
12
13
# File 'lib/processout/native_apm_request.rb', line 11

def parameter_values
  @parameter_values
end

Instance Method Details

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



61
62
63
64
65
66
67
68
69
70
# File 'lib/processout/native_apm_request.rb', line 61

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "parameter_values"
    self.parameter_values = data["parameter_values"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new NativeAPMRequest using the current client



47
48
49
# File 'lib/processout/native_apm_request.rb', line 47

def new(data = {})
  NativeAPMRequest.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



75
76
77
78
79
80
81
82
# File 'lib/processout/native_apm_request.rb', line 75

def prefill(data)
  if data.nil?
    return self
  end
  self.parameter_values = data.fetch(:parameter_values, self.parameter_values)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



52
53
54
55
56
# File 'lib/processout/native_apm_request.rb', line 52

def to_json(options)
  {
      "parameter_values": self.parameter_values,
  }.to_json
end