Sha256: ee1b616d15080ea076f55842418868c3276272dc9252e00c4feefaf0a5223d23

Contents?: true

Size: 1003 Bytes

Versions: 22

Compression:

Stored size: 1003 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

        def destroy(user_id)
          delete_request "/users/#{user_id}"
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
dato-0.3.20 lib/dato/site/repo/user.rb
dato-0.3.19 lib/dato/site/repo/user.rb
dato-0.3.18 lib/dato/site/repo/user.rb
dato-0.3.17 lib/dato/site/repo/user.rb
dato-0.3.16 lib/dato/site/repo/user.rb
dato-0.3.15 lib/dato/site/repo/user.rb
dato-0.3.14 lib/dato/site/repo/user.rb
dato-0.3.13 lib/dato/site/repo/user.rb
dato-0.3.12 lib/dato/site/repo/user.rb
dato-0.3.9.1 lib/dato/site/repo/user.rb
dato-0.3.11 lib/dato/site/repo/user.rb
dato-0.3.10 lib/dato/site/repo/user.rb
dato-0.3.9 lib/dato/site/repo/user.rb
dato-0.3.8 lib/dato/site/repo/user.rb
dato-0.3.7 lib/dato/site/repo/user.rb
dato-0.3.6 lib/dato/site/repo/user.rb
dato-0.3.5 lib/dato/site/repo/user.rb
dato-0.3.3 lib/dato/site/repo/user.rb
dato-0.3.2 lib/dato/site/repo/user.rb
dato-0.3.1 lib/dato/site/repo/user.rb