Sha256: 9e01c41b3031529ae1016416cf059678460b05602f0cc8c7fa0fa8c63cc6a38c

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 Bytes

Contents

# frozen_string_literal: true
require 'dato/site/repo/base'

module Dato
  module Site
    module Repo
      class User < Base
        def create(resource_attributes)
          body = JsonApiSerializer.new(
            type: :user,
            attributes: %i(email first_name last_name),
            required_attributes: %i(email first_name last_name)
          ).serialize(resource_attributes)

          post_request '/users', body
        end

        def all
          get_request '/users'
        end

        def find(user_id)
          get_request "/users/#{user_id}"
        end

        def reset_password(resource_attributes)
          body = JsonApiSerializer.new(
            type: :user,
            attributes: %i(email),
            required_attributes: %i(email)
          ).serialize(resource_attributes)

          post_request '/users/reset_password', body
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dato-0.2.6 lib/dato/site/repo/user.rb