sugarcrm 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -30,6 +30,9 @@ e.g. +SugarCRM::Contacts.find_by_title("VP of Sales")+ will work, but +SugarCRM:
30
30
  # Establish a connection
31
31
  SugarCRM::Base.establish_connection("http://localhost/sugarcrm", 'user', 'password', {:debug => false})
32
32
 
33
+ # Get the logged in user
34
+ SugarCRM.current_user
35
+
33
36
  # Retrieve a user by user_name
34
37
  SugarCRM::User.find_by_user_name("admin")
35
38
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.7
1
+ 0.7.8
data/lib/sugarcrm/base.rb CHANGED
@@ -28,9 +28,10 @@ module SugarCRM; class Base
28
28
  def establish_connection(url, user, pass, opts={})
29
29
  options = {
30
30
  :debug => false,
31
+ :register_modules => true,
31
32
  }.merge(opts)
32
33
  @debug = options[:debug]
33
- @@connection = SugarCRM::Connection.new(url, user, pass, @debug)
34
+ @@connection = SugarCRM::Connection.new(url, user, pass, options)
34
35
  end
35
36
 
36
37
  def find(*args)
@@ -15,4 +15,9 @@ module SugarCRM
15
15
  def self.modules=(modules)
16
16
  @@modules = modules
17
17
  end
18
+
19
+ def self.current_user
20
+ SugarCRM::User.find_by_user_name(connection.user)
21
+ end
22
+
18
23
  end
@@ -2,6 +2,11 @@ require 'helper'
2
2
 
3
3
  class TestSugarCRM < Test::Unit::TestCase
4
4
  context "A SugarCRM::Base instance" do
5
+
6
+ should "establish a connection when Base#establish_connection" do
7
+ SugarCRM::Base.establish_connection(URL, USER, PASS)
8
+ assert SugarCRM.connection.connected?
9
+ end
5
10
 
6
11
  should "return the module name" do
7
12
  assert_equal "Users", SugarCRM::User._module.name
@@ -13,7 +18,11 @@ class TestSugarCRM < Test::Unit::TestCase
13
18
  end
14
19
 
15
20
  should "respond to self.connection.logged_in?" do
16
- assert SugarCRM::User.connection.logged_in?
21
+ assert_respond_to SugarCRM::User.connection, :logged_in?
22
+ end
23
+
24
+ should "respond to self.current_user" do
25
+ assert_instance_of SugarCRM::User, SugarCRM.current_user
17
26
  end
18
27
 
19
28
  should "respond to self.attributes_from_modules_fields" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcrm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 7
10
- version: 0.7.7
9
+ - 8
10
+ version: 0.7.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Carl Hicks
@@ -75,7 +75,6 @@ extra_rdoc_files:
75
75
  - README.rdoc
76
76
  files:
77
77
  - .document
78
- - .gitignore
79
78
  - LICENSE
80
79
  - README.rdoc
81
80
  - Rakefile
@@ -137,8 +136,8 @@ homepage: http://github.com/chicks/sugarcrm
137
136
  licenses: []
138
137
 
139
138
  post_install_message:
140
- rdoc_options:
141
- - --charset=UTF-8
139
+ rdoc_options: []
140
+
142
141
  require_paths:
143
142
  - lib
144
143
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC