Class: Lono::Registration::Base
- Inherits:
-
Object
- Object
- Lono::Registration::Base
- Extended by:
- Memoist
- Defined in:
- lib/lono/registration/base.rb
Instance Method Summary collapse
- #api ⇒ Object
- #get_temp_key ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
-
#request_verification(info) ⇒ Object
Same api call for temp_key and registration_key.
- #say(msg) ⇒ Object
- #with_safety ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/lono/registration/base.rb', line 5 def initialize(={}) @options = end |
Instance Method Details
#api ⇒ Object
28 29 30 |
# File 'lib/lono/registration/base.rb', line 28 def api Lono::Api::Client.new end |
#get_temp_key ⇒ Object
16 17 18 19 20 |
# File 'lib/lono/registration/base.rb', line 16 def get_temp_key with_safety do api.temp_key # grab temp registration key end end |
#request_verification(info) ⇒ Object
Same api call for temp_key and registration_key
10 11 12 13 14 |
# File 'lib/lono/registration/base.rb', line 10 def request_verification(info) with_safety do api.verify(info) end end |
#say(msg) ⇒ Object
33 34 35 |
# File 'lib/lono/registration/base.rb', line 33 def say(msg) puts msg if @options[:cli] end |
#with_safety ⇒ Object
22 23 24 25 26 |
# File 'lib/lono/registration/base.rb', line 22 def with_safety yield rescue Errno::ECONNREFUSED, Errno::EAFNOSUPPORT raise if Lono::API != Lono::API_DEFAULT end |