Class: Ruze::Device
- Inherits:
-
Object
- Object
- Ruze::Device
- Defined in:
- lib/ruze/device.rb
Overview
Holds the Gigya trusted-device identity (gmid/ucid) that lets us skip the two-factor prompt on subsequent logins.
This default implementation keeps the pair in memory only. For headless operation across process restarts, seed it from durable storage and persist the pair (see #gmid/#ucid) after a successful bootstrap:
device = Ruze::Device.new(gmid: stored_gmid, ucid: stored_ucid)
Ruze::Car.new(email, password, device: device)
Instance Attribute Summary collapse
-
#gmid ⇒ Object
readonly
Returns the value of attribute gmid.
-
#ucid ⇒ Object
readonly
Returns the value of attribute ucid.
Instance Method Summary collapse
-
#initialize(gmid: nil, ucid: nil) ⇒ Device
constructor
A new instance of Device.
-
#load ⇒ Object
Returns { gmid:, ucid: } or nil when no (complete) device is available.
- #save(gmid:, ucid:) ⇒ Object
Constructor Details
#initialize(gmid: nil, ucid: nil) ⇒ Device
Returns a new instance of Device.
12 13 14 15 |
# File 'lib/ruze/device.rb', line 12 def initialize(gmid: nil, ucid: nil) @gmid = gmid @ucid = ucid end |
Instance Attribute Details
#gmid ⇒ Object (readonly)
Returns the value of attribute gmid.
16 17 18 |
# File 'lib/ruze/device.rb', line 16 def gmid @gmid end |
#ucid ⇒ Object (readonly)
Returns the value of attribute ucid.
16 17 18 |
# File 'lib/ruze/device.rb', line 16 def ucid @ucid end |
Instance Method Details
#load ⇒ Object
Returns { gmid:, ucid: } or nil when no (complete) device is available.
19 20 21 22 23 |
# File 'lib/ruze/device.rb', line 19 def load return nil if gmid.to_s.empty? || ucid.to_s.empty? { gmid: gmid, ucid: ucid } end |
#save(gmid:, ucid:) ⇒ Object
25 26 27 28 |
# File 'lib/ruze/device.rb', line 25 def save(gmid:, ucid:) @gmid = gmid @ucid = ucid end |