Class: ProcessOut::NativeAPMResponse
- Inherits:
-
Object
- Object
- ProcessOut::NativeAPMResponse
- Defined in:
- lib/processout/native_apm_response.rb
Instance Attribute Summary collapse
-
#parameter_definitions ⇒ Object
Returns the value of attribute parameter_definitions.
-
#parameter_values ⇒ Object
Returns the value of attribute parameter_values.
-
#state ⇒ Object
Returns the value of attribute state.
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 = {}) ⇒ NativeAPMResponse
constructor
- Initializes the NativeAPMResponse object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the NativeAPMResponse object Params:
-
#new(data = {}) ⇒ Object
Create a new NativeAPMResponse 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 = {}) ⇒ NativeAPMResponse
Initializes the NativeAPMResponse object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
65 66 67 68 69 70 71 72 |
# File 'lib/processout/native_apm_response.rb', line 65 def initialize(client, data = {}) @client = client self.state = data.fetch(:state, nil) self.parameter_definitions = data.fetch(:parameter_definitions, nil) self.parameter_values = data.fetch(:parameter_values, nil) end |
Instance Attribute Details
#parameter_definitions ⇒ Object
Returns the value of attribute parameter_definitions.
12 13 14 |
# File 'lib/processout/native_apm_response.rb', line 12 def parameter_definitions @parameter_definitions end |
#parameter_values ⇒ Object
Returns the value of attribute parameter_values.
13 14 15 |
# File 'lib/processout/native_apm_response.rb', line 13 def parameter_values @parameter_values end |
#state ⇒ Object
Returns the value of attribute state.
11 12 13 |
# File 'lib/processout/native_apm_response.rb', line 11 def state @state 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
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/processout/native_apm_response.rb', line 91 def fill_with_data(data) if data.nil? return self end if data.include? "state" self.state = data["state"] end if data.include? "parameter_definitions" self.parameter_definitions = data["parameter_definitions"] end if data.include? "parameter_values" self.parameter_values = data["parameter_values"] end self end |
#new(data = {}) ⇒ Object
Create a new NativeAPMResponse using the current client
75 76 77 |
# File 'lib/processout/native_apm_response.rb', line 75 def new(data = {}) NativeAPMResponse.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/processout/native_apm_response.rb', line 111 def prefill(data) if data.nil? return self end self.state = data.fetch(:state, self.state) self.parameter_definitions = data.fetch(:parameter_definitions, self.parameter_definitions) 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
80 81 82 83 84 85 86 |
# File 'lib/processout/native_apm_response.rb', line 80 def to_json() { "state": self.state, "parameter_definitions": self.parameter_definitions, "parameter_values": self.parameter_values, }.to_json end |