Sha256: 0f4c57bc89141dec847be3d878eeceff10562c50c2b91cf48aa7401186c2884c

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

module Bearcat
  class Client < Footrest::Client
    module Users

      def list_users(account, params={})
        get("/api/v1/accounts/#{account.to_s}/users", params)
      end

      def user_avatars(user, params={})
        get("/api/v1/users/#{user.to_s}/avatars", params)
      end

      def add_user(account, params={})
        post("/api/v1/accounts/#{account.to_s}/users", params)
      end

      # scope: food
      # params: {ns: 'com.account-domain.canvas-app'}
      # returns all custom user food scope data. If no scope returns all custom user data
      def load_custom_data(user, params, scope = '')
        get("/api/v1/users/#{user}/custom_data/#{scope}", params)
      end

      # scope: food
      # params: {ns: 'com.account-domain.canvas-app',
      #          data: {'favorite' => 'steak', 'least favorite' => 'water mellon'}}
      # stores custom data in the food scope
      def store_custom_data(user, params, scope = '')
        put("/api/v1/users/#{user}/custom_data/#{scope}", params)
      end

      # scope: food
      # params: {ns: 'com.account-domain.canvas-app'}
      # deletes all custom user data for the food scope. If no scope deletes all custom user data
      def delete_custom_data(user, params, scope = '')
        delete("/api/v1/users/#{user}/custom_data/#{scope}", params)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bearcat-0.9.6 lib/bearcat/client/users.rb