Sha256: 4c70aeeb7c36ab8c6dcdc4094cb2080432a9a411443d8f5fb8bf4318fba36a56

Contents?: true

Size: 707 Bytes

Versions: 4

Compression:

Stored size: 707 Bytes

Contents

module Lifen
  class User < Base

    attribute :uuid, String
    attribute :token, String

    attribute :email, String
    attribute :last_name, String
    attribute :first_name, String

    def flows
      Lifen::Flows.new(self).all
    end

    def create!
      authentication = Lifen::Authentication.new(user: self)
      authentication.register!

      self.token = authentication.token
      self.uuid = authentication.uuid

      self
    end

    def refresh_token
      authentication = Lifen::Authentication.new(user: self)
      authentication.refresh_token

      self.token = authentication.token

      self
    end

    def client
      UserAuthenticatedClient.new(token)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lifen-0.1.3 lib/lifen/user.rb
lifen-0.1.2 lib/lifen/user.rb
lifen-0.1.1 lib/lifen/user.rb
lifen-0.1.0 lib/lifen/user.rb