Module: Telegram::Auth

Defined in:
lib/telegram/auth.rb,
lib/telegram/auth/fields.rb,
lib/telegram/auth/version.rb,
lib/telegram/auth/verification.rb,
lib/telegram/auth/configuration.rb

Defined Under Namespace

Classes: Configuration, ConfigurationError, Error, ExpiredError, Fields, ShaError, Verification

Constant Summary collapse

VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.configure {|Configuration.instance| ... } ⇒ Object

Yields:



13
14
15
# File 'lib/telegram/auth.rb', line 13

def self.configure(&block)
  yield(Configuration.instance) if block_given?
end

.configure!(&blk) ⇒ Object



17
18
19
20
# File 'lib/telegram/auth.rb', line 17

def self.configure!(&blk)
  configure(&blk)
  Configuration.instance.verify!
end

.create(hash:, **field_data) {|verification.error| ... } ⇒ Object

Yields:

  • (verification.error)


22
23
24
25
26
27
# File 'lib/telegram/auth.rb', line 22

def self.create(hash:, **field_data)
  verification = Verification.new(hash, Fields.new(field_data))
  success = verification.process
  yield(verification.error) if !success && block_given?
  success
end

.loggerObject



33
34
35
# File 'lib/telegram/auth.rb', line 33

def self.logger
  @logger
end

.logger=(logger) ⇒ Object



29
30
31
# File 'lib/telegram/auth.rb', line 29

def self.logger=(logger)
  @logger = logger
end