Class: ProcessOut::Device
- Inherits:
-
Object
- Object
- ProcessOut::Device
- Defined in:
- lib/processout/device.rb
Instance Attribute Summary collapse
-
#app_color_depth ⇒ Object
Returns the value of attribute app_color_depth.
-
#app_java_enabled ⇒ Object
Returns the value of attribute app_java_enabled.
-
#app_language ⇒ Object
Returns the value of attribute app_language.
-
#app_screen_height ⇒ Object
Returns the value of attribute app_screen_height.
-
#app_screen_width ⇒ Object
Returns the value of attribute app_screen_width.
-
#app_timezone_offset ⇒ Object
Returns the value of attribute app_timezone_offset.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#header_accept ⇒ Object
Returns the value of attribute header_accept.
-
#header_referer ⇒ Object
Returns the value of attribute header_referer.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#request_origin ⇒ Object
Returns the value of attribute request_origin.
-
#threeds_sdk ⇒ Object
Returns the value of attribute threeds_sdk.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Instance Method Summary collapse
-
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data::Hashof data coming from the API. -
#initialize(client, data = {}) ⇒ Device
constructor
Initializes the Device object Params:
client::ProcessOutclient instancedata:: data that can be used to fill the object. -
#new(data = {}) ⇒ Object
Create a new Device using the current client.
-
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data::Hashof data. -
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ Device
Initializes the Device object Params:
clientProcessOutclient instancedatadata that can be used to fill the object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/processout/device.rb', line 93 def initialize(client, data = {}) @client = client self.request_origin = data.fetch(:request_origin, nil) self.id = data.fetch(:id, nil) self.channel = data.fetch(:channel, nil) self.threeds_sdk = data.fetch(:threeds_sdk, nil) self.platform = data.fetch(:platform, nil) self.ip_address = data.fetch(:ip_address, nil) self.user_agent = data.fetch(:user_agent, nil) self.header_accept = data.fetch(:header_accept, nil) self.header_referer = data.fetch(:header_referer, nil) self.app_color_depth = data.fetch(:app_color_depth, nil) self.app_java_enabled = data.fetch(:app_java_enabled, nil) self.app_language = data.fetch(:app_language, nil) self.app_screen_height = data.fetch(:app_screen_height, nil) self.app_screen_width = data.fetch(:app_screen_width, nil) self.app_timezone_offset = data.fetch(:app_timezone_offset, nil) end |
Instance Attribute Details
#app_color_depth ⇒ Object
Returns the value of attribute app_color_depth.
20 21 22 |
# File 'lib/processout/device.rb', line 20 def app_color_depth @app_color_depth end |
#app_java_enabled ⇒ Object
Returns the value of attribute app_java_enabled.
21 22 23 |
# File 'lib/processout/device.rb', line 21 def app_java_enabled @app_java_enabled end |
#app_language ⇒ Object
Returns the value of attribute app_language.
22 23 24 |
# File 'lib/processout/device.rb', line 22 def app_language @app_language end |
#app_screen_height ⇒ Object
Returns the value of attribute app_screen_height.
23 24 25 |
# File 'lib/processout/device.rb', line 23 def app_screen_height @app_screen_height end |
#app_screen_width ⇒ Object
Returns the value of attribute app_screen_width.
24 25 26 |
# File 'lib/processout/device.rb', line 24 def app_screen_width @app_screen_width end |
#app_timezone_offset ⇒ Object
Returns the value of attribute app_timezone_offset.
25 26 27 |
# File 'lib/processout/device.rb', line 25 def app_timezone_offset @app_timezone_offset end |
#channel ⇒ Object
Returns the value of attribute channel.
13 14 15 |
# File 'lib/processout/device.rb', line 13 def channel @channel end |
#header_accept ⇒ Object
Returns the value of attribute header_accept.
18 19 20 |
# File 'lib/processout/device.rb', line 18 def header_accept @header_accept end |
#header_referer ⇒ Object
Returns the value of attribute header_referer.
19 20 21 |
# File 'lib/processout/device.rb', line 19 def header_referer @header_referer end |
#id ⇒ Object
Returns the value of attribute id.
12 13 14 |
# File 'lib/processout/device.rb', line 12 def id @id end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
16 17 18 |
# File 'lib/processout/device.rb', line 16 def ip_address @ip_address end |
#platform ⇒ Object
Returns the value of attribute platform.
15 16 17 |
# File 'lib/processout/device.rb', line 15 def platform @platform end |
#request_origin ⇒ Object
Returns the value of attribute request_origin.
11 12 13 |
# File 'lib/processout/device.rb', line 11 def request_origin @request_origin end |
#threeds_sdk ⇒ Object
Returns the value of attribute threeds_sdk.
14 15 16 |
# File 'lib/processout/device.rb', line 14 def threeds_sdk @threeds_sdk end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
17 18 19 |
# File 'lib/processout/device.rb', line 17 def user_agent @user_agent end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
dataHashof data coming from the API
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/processout/device.rb', line 143 def fill_with_data(data) if data.nil? return self end if data.include? "request_origin" self.request_origin = data["request_origin"] end if data.include? "id" self.id = data["id"] end if data.include? "channel" self.channel = data["channel"] end if data.include? "threeds_sdk" self.threeds_sdk = data["threeds_sdk"] end if data.include? "platform" self.platform = data["platform"] end if data.include? "ip_address" self.ip_address = data["ip_address"] end if data.include? "user_agent" self.user_agent = data["user_agent"] end if data.include? "header_accept" self.header_accept = data["header_accept"] end if data.include? "header_referer" self.header_referer = data["header_referer"] end if data.include? "app_color_depth" self.app_color_depth = data["app_color_depth"] end if data.include? "app_java_enabled" self.app_java_enabled = data["app_java_enabled"] end if data.include? "app_language" self.app_language = data["app_language"] end if data.include? "app_screen_height" self.app_screen_height = data["app_screen_height"] end if data.include? "app_screen_width" self.app_screen_width = data["app_screen_width"] end if data.include? "app_timezone_offset" self.app_timezone_offset = data["app_timezone_offset"] end self end |
#new(data = {}) ⇒ Object
Create a new Device using the current client
115 116 117 |
# File 'lib/processout/device.rb', line 115 def new(data = {}) Device.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
dataHashof data
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/processout/device.rb', line 199 def prefill(data) if data.nil? return self end self.request_origin = data.fetch(:request_origin, self.request_origin) self.id = data.fetch(:id, self.id) self.channel = data.fetch(:channel, self.channel) self.threeds_sdk = data.fetch(:threeds_sdk, self.threeds_sdk) self.platform = data.fetch(:platform, self.platform) self.ip_address = data.fetch(:ip_address, self.ip_address) self.user_agent = data.fetch(:user_agent, self.user_agent) self.header_accept = data.fetch(:header_accept, self.header_accept) self.header_referer = data.fetch(:header_referer, self.header_referer) self.app_color_depth = data.fetch(:app_color_depth, self.app_color_depth) self.app_java_enabled = data.fetch(:app_java_enabled, self.app_java_enabled) self.app_language = data.fetch(:app_language, self.app_language) self.app_screen_height = data.fetch(:app_screen_height, self.app_screen_height) self.app_screen_width = data.fetch(:app_screen_width, self.app_screen_width) self.app_timezone_offset = data.fetch(:app_timezone_offset, self.app_timezone_offset) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/processout/device.rb', line 120 def to_json() { "request_origin": self.request_origin, "id": self.id, "channel": self.channel, "threeds_sdk": self.threeds_sdk, "platform": self.platform, "ip_address": self.ip_address, "user_agent": self.user_agent, "header_accept": self.header_accept, "header_referer": self.header_referer, "app_color_depth": self.app_color_depth, "app_java_enabled": self.app_java_enabled, "app_language": self.app_language, "app_screen_height": self.app_screen_height, "app_screen_width": self.app_screen_width, "app_timezone_offset": self.app_timezone_offset, }.to_json end |