Class: DPay::DeviceInfo
- Inherits:
-
Object
- Object
- DPay::DeviceInfo
- Defined in:
- lib/dpay/payment/device_info.rb,
sig/dpay/payment/device_info.rbs
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(fields) ⇒ DeviceInfo
constructor
A new instance of DeviceInfo.
- #to_h ⇒ Hash[String, untyped]
- #with_browser_java_enabled(enabled) ⇒ self
Constructor Details
#initialize(fields) ⇒ DeviceInfo
Returns a new instance of DeviceInfo.
26 27 28 29 |
# File 'lib/dpay/payment/device_info.rb', line 26 def initialize(fields) @fields = fields @browser_java_enabled = nil end |
Class Method Details
.create(browser_accept_header:, browser_language:, browser_color_depth:, browser_screen_height:, browser_screen_width:, browser_tz:, browser_user_agent:, system_family:, geo_localization:, device_id:, application_name:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/dpay/payment/device_info.rb', line 5 def self.create(browser_accept_header:, browser_language:, browser_color_depth:, browser_screen_height:, browser_screen_width:, browser_tz:, browser_user_agent:, system_family:, geo_localization:, device_id:, application_name:) new( { "browserAcceptHeader" => browser_accept_header, "browserLanguage" => browser_language, "browserColorDepth" => browser_color_depth, "browserScreenHeight" => browser_screen_height, "browserScreenWidth" => browser_screen_width, "browserTZ" => browser_tz, "browserUserAgent" => browser_user_agent, "systemFamily" => system_family, "geoLocalization" => geo_localization, "deviceID" => bounded(device_id, "Device ID"), "applicationName" => bounded(application_name, "Application name") } ) end |
Instance Method Details
#to_h ⇒ Hash[String, untyped]
36 37 38 39 40 |
# File 'lib/dpay/payment/device_info.rb', line 36 def to_h data = @fields.dup data["browserJavaEnabled"] = @browser_java_enabled ? "true" : "false" unless @browser_java_enabled.nil? data end |
#with_browser_java_enabled(enabled) ⇒ self
31 32 33 34 |
# File 'lib/dpay/payment/device_info.rb', line 31 def with_browser_java_enabled(enabled) @browser_java_enabled = enabled self end |