Class: ProcessOut::NativeAPMParameterValue
- Inherits:
-
Object
- Object
- ProcessOut::NativeAPMParameterValue
- Defined in:
- lib/processout/native_apm_parameter_value.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ NativeAPMParameterValue
constructor
- Initializes the NativeAPMParameterValue object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the NativeAPMParameterValue object Params:
-
#new(data = {}) ⇒ Object
Create a new NativeAPMParameterValue using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data
-
Hash
of data.
- Prefills the object with the data passed as parameters Params:
-
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ NativeAPMParameterValue
Initializes the NativeAPMParameterValue object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
28 29 30 31 32 33 34 |
# File 'lib/processout/native_apm_parameter_value.rb', line 28 def initialize(client, data = {}) @client = client self.key = data.fetch(:key, nil) self.value = data.fetch(:value, nil) end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
11 12 13 |
# File 'lib/processout/native_apm_parameter_value.rb', line 11 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
12 13 14 |
# File 'lib/processout/native_apm_parameter_value.rb', line 12 def value @value 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
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/processout/native_apm_parameter_value.rb', line 52 def fill_with_data(data) if data.nil? return self end if data.include? "key" self.key = data["key"] end if data.include? "value" self.value = data["value"] end self end |
#new(data = {}) ⇒ Object
Create a new NativeAPMParameterValue using the current client
37 38 39 |
# File 'lib/processout/native_apm_parameter_value.rb', line 37 def new(data = {}) NativeAPMParameterValue.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
69 70 71 72 73 74 75 76 77 |
# File 'lib/processout/native_apm_parameter_value.rb', line 69 def prefill(data) if data.nil? return self end self.key = data.fetch(:key, self.key) self.value = data.fetch(:value, self.value) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
42 43 44 45 46 47 |
# File 'lib/processout/native_apm_parameter_value.rb', line 42 def to_json() { "key": self.key, "value": self.value, }.to_json end |