Sha256: 5e0f5ccb2f319067424a62c5f053ea9d4664cbe726e07965740c4a67a7f8a698

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

module Coop
  class Session
    attr_accessor :email
    
    # Public: Creates a new API session
    #
    # email - (String) the user's email
    # password - (String) the user's password
    #
    # Examples
    #
    #   Coop::Session.new("test@example.com", "password123")
    #   # => #<Coop::Session @email="test@example.com">
    #
    # Returns a Coop::Session instance
    def initialize(email, password)
      @email = email
      password = password
    end
    
    # Public: Creates a Coop::Group object
    #
    # id - (Fixnum) the group id (as found in the app URL: http://coopapp.com/groups/[group_id])
    #
    # Examples
    #
    #   session.group(12345)
    #   # => #<Coop::Group @id=12345>
    #
    # Returns a Coop::Group instance
    def group(id)
      Coop::Group.new({
        id: id
      })
    end
    
    # Public: Creates a Coop::Group object
    #
    # id - (Fixnum) the group id (as found in the app URL: http://coopapp.com/groups/[group_id]/users/[user_id])
    #
    # Examples
    #
    #   session.user(12345)
    #   # => #<Coop::User @id=12345>
    #
    # Returns a Coop::User instance
    def user(id)
      Coop::User.find(id)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coop-1.0.1 lib/coop/session.rb
coop-1.0.0 lib/coop/session.rb