Class: Telegram::AuthProperties
- Inherits:
-
Object
- Object
- Telegram::AuthProperties
- Extended by:
- Forwardable
- Defined in:
- lib/telegram/auth_properties.rb
Overview
Telegram client authorization properties
Available options:
* phone_number: phone number which will be authorized
* confirmation: proc which should return confirmation code received via
text message, or call
* register(optional): hash with two options
- :first_name: user first name
- :last_name: user last name
Constant Summary collapse
- DEFAULT_OPTIONS =
{ confirmation: -> {}, registration: {}, }.freeze
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AuthProperties
constructor
A new instance of AuthProperties.
- #present? ⇒ Boolean
- #register? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ AuthProperties
Returns a new instance of AuthProperties.
25 26 27 |
# File 'lib/telegram/auth_properties.rb', line 25 def initialize( = {}) @options = OpenStruct.new(DEFAULT_OPTIONS.merge()) end |
Instance Method Details
#present? ⇒ Boolean
34 35 36 |
# File 'lib/telegram/auth_properties.rb', line 34 def present? !phone_number.nil? end |
#register? ⇒ Boolean
29 30 31 32 |
# File 'lib/telegram/auth_properties.rb', line 29 def register? registration.include?(:first_name) && registration.include?(:last_name) end |