Sha256: b4c223c35b3737ee629bc723834160dd7a86d333df236d5841844be8465ff2b0

Contents?: true

Size: 926 Bytes

Versions: 11

Compression:

Stored size: 926 Bytes

Contents

module DataMapper
  module Is

    module Parse
      def is_parse(options = {})
        property :id, Property::ParseKey
        property :created_at, Property::ParseDate, field: "createdAt"
        property :updated_at, Property::ParseDate, field: "updatedAt"
      end

      def is_parse_user(options = {})
        is_parse(options)

        storage_names[:default] = "_User"

        property :username, Property::String
        property :password, Property::String
        property :email,    Property::String, format: :email_address

        class << self
          def authenticate(username, password)
            result = repository.adapter.sign_in(username, password)
            get(result["objectId"])
          end

          def request_password_reset(email)
            repository.adapter.request_password_reset email
          end
        end
      end
    end

  end

  Model.append_extensions(Is::Parse)
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dm-parse-0.3.5 lib/is/parse.rb
dm-parse-0.3.4 lib/is/parse.rb
dm-parse-0.3.3 lib/is/parse.rb
dm-parse-0.3.2 lib/is/parse.rb
dm-parse-0.3.1 lib/is/parse.rb
dm-parse-0.3.0 lib/is/parse.rb
dm-parse-0.2.3 lib/is/parse.rb
dm-parse-0.2.2 lib/is/parse.rb
dm-parse-0.2.1 lib/is/parse.rb
dm-parse-0.2.0 lib/is/parse.rb
dm-parse-0.1.0 lib/is/parse.rb