Class: Mingle4r::MingleClient

Inherits:
Object
  • Object
show all
Defined in:
lib/mingle4r/mingle_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site, user, password, proj_id = nil) ⇒ MingleClient

Returns a new instance of MingleClient.



5
6
7
8
9
10
11
# File 'lib/mingle4r/mingle_client.rb', line 5

def initialize(site, user, password, proj_id = nil)
  @site = site
  @user = user
  @password = password
  @proj_id = proj_id
  set_resource_attributes()
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/mingle4r/mingle_client.rb', line 3

def password
  @password
end

#proj_idObject

Returns the value of attribute proj_id.



3
4
5
# File 'lib/mingle4r/mingle_client.rb', line 3

def proj_id
  @proj_id
end

#siteObject

Returns the value of attribute site.



3
4
5
# File 'lib/mingle4r/mingle_client.rb', line 3

def site
  @site
end

#userObject

Returns the value of attribute user.



3
4
5
# File 'lib/mingle4r/mingle_client.rb', line 3

def user
  @user
end

Instance Method Details

#cardsObject



70
71
72
73
74
# File 'lib/mingle4r/mingle_client.rb', line 70

def cards
  raise 'proj_id attribute not set' unless @proj_id
  @project = Mingle4r::Project.find(@proj_id) unless(@project && (@proj_id == @project.identifier))
  @project.cards
end

#projectObject



60
61
62
63
64
# File 'lib/mingle4r/mingle_client.rb', line 60

def project
  raise 'proj_id attribute not set' unless @proj_id
  @project = Mingle4r::Project.find(@proj_id) unless(@project && (@proj_id == @project.identifier))
  @project
end

#projectsObject



66
67
68
# File 'lib/mingle4r/mingle_client.rb', line 66

def projects
  Mingle4r::Project.find(:all)
end

#usersObject



76
77
78
# File 'lib/mingle4r/mingle_client.rb', line 76

def users
  Mingle4r::User.find(:all)
end

#valid_credentials?Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/mingle4r/mingle_client.rb', line 48

def valid_credentials?
  Project.site = site
  Project.user = user
  Project.password = password
  begin
    Project.find(:all)
    true
  rescue Exception => e
    e.message
  end
end