Sha256: edeac64dd6f813051f21e14f7ccc49278fd894b730a8cca7ee230a63baf91218

Contents?: true

Size: 2 KB

Versions: 3

Compression:

Stored size: 2 KB

Contents

module OmiseGO
  class User < Base
    attributes :id, :username, :provider_user_id, :metadata, :encrypted_metadata

    class << self
      def login(provider_user_id:, client: nil)
        request(client).send('user.login', provider_user_id: provider_user_id).data
      end

      def find(provider_user_id:, client: nil)
        return ErrorHandler.handle(:nil_id) unless provider_user_id
        request(client).send('user.get', provider_user_id: provider_user_id).data
      end

      def create(provider_user_id:, username:, metadata: {},
                 encrypted_metadata: {}, client: nil)
        request(client).send('user.create', provider_user_id: provider_user_id,
                                            username: username,
                                            metadata: metadata,
                                            encrypted_metadata: encrypted_metadata).data
      end

      def update(provider_user_id:, username:, metadata: {},
                 encrypted_metadata: {}, client: nil)
        request(client).send('user.update', provider_user_id: provider_user_id,
                                            username: username,
                                            metadata: metadata,
                                            encrypted_metadata: encrypted_metadata).data
      end

      def wallets(provider_user_id:, client: nil)
        request(client).send('user.get_wallets', provider_user_id: provider_user_id).data
      end
    end

    def login(client: nil)
      self.class.login(provider_user_id, client: client)
    end

    def update(username:, metadata: {}, encrypted_metadata: {}, client: nil)
      self.class.update(provider_user_id: provider_user_id,
                        username: username,
                        metadata: metadata,
                        encrypted_metadata: encrypted_metadata,
                        client: client)
    end

    def wallets(client: nil)
      self.class.wallets(provider_user_id: provider_user_id, client: client)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omisego-0.12.0 lib/omisego/user.rb
omisego-0.11.0 lib/omisego/user.rb
omisego-0.10.0 lib/omisego/user.rb