soleone-highrise 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG +91 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.mkdn +86 -0
  5. data/Rakefile +46 -0
  6. data/VERSION.yml +4 -0
  7. data/autotest/discover.rb +3 -0
  8. data/examples/config_initializers_highrise.rb +12 -0
  9. data/examples/extending.rb +31 -0
  10. data/examples/sample.rb +10 -0
  11. data/highrise.gemspec +131 -0
  12. data/install.rb +1 -0
  13. data/lib/cachable.rb +77 -0
  14. data/lib/highrise.rb +22 -0
  15. data/lib/highrise/base.rb +9 -0
  16. data/lib/highrise/comment.rb +4 -0
  17. data/lib/highrise/company.rb +14 -0
  18. data/lib/highrise/curlhelper.rb +27 -0
  19. data/lib/highrise/curly.rb +101 -0
  20. data/lib/highrise/deal.rb +35 -0
  21. data/lib/highrise/email.rb +9 -0
  22. data/lib/highrise/group.rb +7 -0
  23. data/lib/highrise/kase.rb +8 -0
  24. data/lib/highrise/membership.rb +4 -0
  25. data/lib/highrise/note.rb +9 -0
  26. data/lib/highrise/pagination.rb +29 -0
  27. data/lib/highrise/person.rb +43 -0
  28. data/lib/highrise/subject.rb +50 -0
  29. data/lib/highrise/tag.rb +18 -0
  30. data/lib/highrise/taggable.rb +33 -0
  31. data/lib/highrise/task.rb +26 -0
  32. data/lib/highrise/user.rb +11 -0
  33. data/spec/cachable_spec.rb +68 -0
  34. data/spec/highrise/base_spec.rb +13 -0
  35. data/spec/highrise/comment_spec.rb +14 -0
  36. data/spec/highrise/companies/16883216.html +1723 -0
  37. data/spec/highrise/company_spec.rb +70 -0
  38. data/spec/highrise/curlhelper_spec.rb +35 -0
  39. data/spec/highrise/curly_spec.rb +36 -0
  40. data/spec/highrise/email_spec.rb +25 -0
  41. data/spec/highrise/group_spec.rb +14 -0
  42. data/spec/highrise/kase_spec.rb +25 -0
  43. data/spec/highrise/membership_spec.rb +14 -0
  44. data/spec/highrise/note_spec.rb +23 -0
  45. data/spec/highrise/pagination_spec.rb +10 -0
  46. data/spec/highrise/people/16887003.html +1733 -0
  47. data/spec/highrise/person_spec.rb +83 -0
  48. data/spec/highrise/subject_spec.rb +43 -0
  49. data/spec/highrise/tag_spec.rb +24 -0
  50. data/spec/highrise/task_spec.rb +23 -0
  51. data/spec/highrise/user_spec.rb +30 -0
  52. data/spec/spec.opts +7 -0
  53. data/spec/spec_helper.rb +20 -0
  54. data/uninstall.rb +1 -0
  55. metadata +176 -0
@@ -0,0 +1,83 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Highrise::Person do
4
+
5
+ before(:each) do
6
+ Highrise::Base.site = 'http://example.com.i:3000'
7
+ @person = Highrise::Person.new
8
+ returning @tags = [] do
9
+ @tags << Highrise::Tag.new(:id => "414578", :name => "cliente")
10
+ @tags << Highrise::Tag.new(:id => "414587", :name => "walk")
11
+ end
12
+ end
13
+
14
+ it "should be instance of Highrise::Subject" do
15
+ @person.kind_of?(Highrise::Subject).should be_true
16
+ end
17
+
18
+ describe ".find_all_across_pages_since" do
19
+
20
+ it "should delegate to find_all_across_pages with correct params" do
21
+ time = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
22
+ Highrise::Person.should_receive(:find_all_across_pages).with({:params=>{:since=>"20090114174311"}}).and_return("result")
23
+ Highrise::Person.find_all_across_pages_since(time).should == "result"
24
+ end
25
+
26
+ end
27
+
28
+ describe ".company" do
29
+
30
+ it "should return nil when doesn't have company_id" do
31
+ @person.should_receive(:company_id).and_return(nil)
32
+ @person.company.should be_nil
33
+ end
34
+
35
+ it "should delegate to Highrise::Company when have company_id" do
36
+ @person.should_receive(:company_id).at_least(2).times.and_return(1)
37
+ Highrise::Company.should_receive(:find).with(1).and_return("company")
38
+ @person.company.should == "company"
39
+ end
40
+
41
+ end
42
+
43
+ describe ".name" do
44
+
45
+ it "should concat fist_name with last_name and strip" do
46
+ @person.should_receive(:first_name).and_return("Marcos")
47
+ @person.should_receive(:last_name).and_return("Tapajós ")
48
+ @person.name.should == "Marcos Tapajós"
49
+ end
50
+
51
+ end
52
+
53
+ describe ".tags" do
54
+
55
+ it "should return an array of all tags for that user." do
56
+ file_path = File.dirname(__FILE__) + "/people/16887003.html"
57
+ @person.stub!(:get_document).and_return(Hpricot(File.open(file_path,"r"){|f| f.read}))
58
+ @person.tags.should == @tags
59
+ end
60
+
61
+ end
62
+
63
+ describe "tag!(tag_name)" do
64
+
65
+ it "should create a tag for this user." do
66
+ @person.should_receive(:post).with(:tags, :name => "Forum_User" ).at_least(1).times.and_return(true)
67
+ @person.tag!("Forum_User").should be_true
68
+ end
69
+
70
+ end
71
+
72
+ describe "untag!(tag_name)" do
73
+
74
+ it "should delete a tag for this user." do
75
+ file_path = File.dirname(__FILE__) + "/people/16887003.html"
76
+ @person.stub!(:get_document).and_return(Hpricot(File.open(file_path,"r"){|f| f.read}))
77
+ @person.should_receive(:delete).with("tags/414578").at_least(1).times.and_return(true)
78
+ @person.untag!("cliente").should be_true
79
+ end
80
+
81
+ end
82
+
83
+ end
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Highrise::Subject do
4
+
5
+ before(:each) do
6
+ @subject = Highrise::Subject.new
7
+ end
8
+
9
+ it "should be instance of Highrise::Base" do
10
+ @subject.kind_of?(Highrise::Base).should be_true
11
+ end
12
+
13
+ describe ".notes" do
14
+
15
+ it "should delegate to Highrise::Note with correct params" do
16
+ @subject.should_receive(:id).and_return(1)
17
+ Highrise::Note.should_receive(:find_all_across_pages).with({:from=>"/subjects/1/notes.xml"}).and_return("notes")
18
+ @subject.notes.should == "notes"
19
+ end
20
+
21
+ end
22
+
23
+ describe ".emails" do
24
+
25
+ it "should delegate to Highrise::Email with correct params" do
26
+ @subject.should_receive(:id).and_return(1)
27
+ Highrise::Email.should_receive(:find_all_across_pages).with({:from=>"/subjects/1/emails.xml"}).and_return("emails")
28
+ @subject.emails.should == "emails"
29
+ end
30
+
31
+ end
32
+
33
+ describe ".upcoming_tasks" do
34
+
35
+ it "should delegate to Highrise::Task with correct params" do
36
+ @subject.should_receive(:id).and_return(1)
37
+ Highrise::Task.should_receive(:find).with(:all, {:from=>"/subjects/1/tasks.xml"}).and_return("tasks")
38
+ @subject.upcoming_tasks.should == "tasks"
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Highrise::Tag do
4
+
5
+ before(:each) do
6
+ Highrise::Base.site = 'http://example.com.i/'
7
+ @tag = Highrise::Tag.new(:id => 1, :name => "Name")
8
+ end
9
+
10
+ it "should be instance of Highrise::Base" do
11
+ @tag.kind_of?(Highrise::Base).should be_true
12
+ end
13
+
14
+ it "should support equality" do
15
+ tag = Highrise::Tag.new(:id => 1, :name => "Name")
16
+ @tag.should == tag
17
+ end
18
+
19
+ it "it should find_by_name" do
20
+ tag = Highrise::Tag.new(:id => 2, :name => "Next")
21
+ Highrise::Tag.should_receive(:find).with(:all).and_return([tag, @tag])
22
+ Highrise::Tag.find_by_name("Name").should == @tag
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Highrise::Task do
4
+
5
+ before(:each) do
6
+ @task = Highrise::Task.new
7
+ end
8
+
9
+ it "should be instance of Highrise::Base" do
10
+ @task.kind_of?(Highrise::Base).should be_true
11
+ end
12
+
13
+ describe ".complete!" do
14
+
15
+ it "should delegate to load_attributes_from_response" do
16
+ @task.should_receive(:load_attributes_from_response).with("post")
17
+ @task.should_receive(:post).with(:complete).and_return("post")
18
+ @task.complete!
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Highrise::User do
4
+
5
+ before(:each) do
6
+ @user = Highrise::User.new
7
+ end
8
+
9
+ it "should be instance of Highrise::Base" do
10
+ @user.kind_of?(Highrise::Base).should be_true
11
+ end
12
+
13
+ def join(group)
14
+ Membership.create(:user_id => id, :group_id => group.id)
15
+ end
16
+
17
+ describe ".joind" do
18
+
19
+ it "should delegate to Highrise::Membership.create" do
20
+ group_mock = mock("group")
21
+ group_mock.should_receive(:id).and_return(2)
22
+ @user.should_receive(:id).and_return(1)
23
+ Highrise::Membership.should_receive(:create).with({:user_id=>1, :group_id=>2})
24
+ @user.join(group_mock)
25
+ end
26
+
27
+ end
28
+
29
+
30
+ end
@@ -0,0 +1,7 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
7
+ -rubygems
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../lib/highrise'
2
+
3
+ def turn_methods_public(classe, method_name = nil)
4
+ if method_name
5
+ classe.class_eval do
6
+ public method_name
7
+ end
8
+ else
9
+ turn_all_methods_public classe
10
+ end
11
+ end
12
+
13
+ def turn_all_methods_public(classe)
14
+ classe.class_eval do
15
+ private_instance_methods.each { |instance_method| public instance_method }
16
+ private_methods.each { |method| public_class_method method }
17
+ protected_instance_methods.each { |instance_method| public instance_method }
18
+ protected_methods.each { |method| public_class_method method }
19
+ end
20
+ end
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: soleone-highrise
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.13.3
5
+ platform: ruby
6
+ authors:
7
+ - "Marcos Tapaj\xC3\xB3s"
8
+ - Ken Mayer
9
+ - Dennis Theisen
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2009-05-29 00:00:00 +02:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: activeresource
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: "2.2"
26
+ version:
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ type: :runtime
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "2.1"
36
+ version:
37
+ - !ruby/object:Gem::Dependency
38
+ name: curb
39
+ type: :runtime
40
+ version_requirement:
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ - !ruby/object:Gem::Dependency
48
+ name: hpricot
49
+ type: :runtime
50
+ version_requirement:
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ description: "\n\
58
+ Based on the original API module from DHH, http://developer.37signals.com/highrise/, this\n\
59
+ gem is a cleaned up, tested version of the same. Contributors have added support for tags \n\
60
+ which are not supported by the API directly\n\n\
61
+ Configure by adding the following:\n\n\
62
+ require 'highrise'\n\
63
+ Highrise::Base.site = 'http://your_site.highrisehq.com/'\n\
64
+ Highrise::Base.user = 'your_api_auth_token'\n "
65
+ email: kmayer@bitwrangler.com
66
+ executables: []
67
+
68
+ extensions: []
69
+
70
+ extra_rdoc_files:
71
+ - README.mkdn
72
+ files:
73
+ - .gitignore
74
+ - CHANGELOG
75
+ - MIT-LICENSE
76
+ - README.mkdn
77
+ - Rakefile
78
+ - VERSION.yml
79
+ - autotest/discover.rb
80
+ - examples/config_initializers_highrise.rb
81
+ - examples/extending.rb
82
+ - examples/sample.rb
83
+ - highrise.gemspec
84
+ - install.rb
85
+ - lib/cachable.rb
86
+ - lib/highrise.rb
87
+ - lib/highrise/base.rb
88
+ - lib/highrise/comment.rb
89
+ - lib/highrise/company.rb
90
+ - lib/highrise/curlhelper.rb
91
+ - lib/highrise/curly.rb
92
+ - lib/highrise/deal.rb
93
+ - lib/highrise/email.rb
94
+ - lib/highrise/group.rb
95
+ - lib/highrise/kase.rb
96
+ - lib/highrise/membership.rb
97
+ - lib/highrise/note.rb
98
+ - lib/highrise/pagination.rb
99
+ - lib/highrise/person.rb
100
+ - lib/highrise/subject.rb
101
+ - lib/highrise/tag.rb
102
+ - lib/highrise/taggable.rb
103
+ - lib/highrise/task.rb
104
+ - lib/highrise/user.rb
105
+ - spec/cachable_spec.rb
106
+ - spec/highrise/base_spec.rb
107
+ - spec/highrise/comment_spec.rb
108
+ - spec/highrise/companies/16883216.html
109
+ - spec/highrise/company_spec.rb
110
+ - spec/highrise/curlhelper_spec.rb
111
+ - spec/highrise/curly_spec.rb
112
+ - spec/highrise/email_spec.rb
113
+ - spec/highrise/group_spec.rb
114
+ - spec/highrise/kase_spec.rb
115
+ - spec/highrise/membership_spec.rb
116
+ - spec/highrise/note_spec.rb
117
+ - spec/highrise/pagination_spec.rb
118
+ - spec/highrise/people/16887003.html
119
+ - spec/highrise/person_spec.rb
120
+ - spec/highrise/subject_spec.rb
121
+ - spec/highrise/tag_spec.rb
122
+ - spec/highrise/task_spec.rb
123
+ - spec/highrise/user_spec.rb
124
+ - spec/spec.opts
125
+ - spec/spec_helper.rb
126
+ - uninstall.rb
127
+ has_rdoc: true
128
+ homepage: http://github.com/kmayer/highrise
129
+ licenses: []
130
+
131
+ post_install_message:
132
+ rdoc_options:
133
+ - --charset=UTF-8
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: "0"
141
+ version:
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: "0"
147
+ version:
148
+ requirements: []
149
+
150
+ rubyforge_project:
151
+ rubygems_version: 1.3.5
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: Ruby wrapper around Highrise API
155
+ test_files:
156
+ - spec/cachable_spec.rb
157
+ - spec/highrise/base_spec.rb
158
+ - spec/highrise/comment_spec.rb
159
+ - spec/highrise/company_spec.rb
160
+ - spec/highrise/curlhelper_spec.rb
161
+ - spec/highrise/curly_spec.rb
162
+ - spec/highrise/email_spec.rb
163
+ - spec/highrise/group_spec.rb
164
+ - spec/highrise/kase_spec.rb
165
+ - spec/highrise/membership_spec.rb
166
+ - spec/highrise/note_spec.rb
167
+ - spec/highrise/pagination_spec.rb
168
+ - spec/highrise/person_spec.rb
169
+ - spec/highrise/subject_spec.rb
170
+ - spec/highrise/tag_spec.rb
171
+ - spec/highrise/task_spec.rb
172
+ - spec/highrise/user_spec.rb
173
+ - spec/spec_helper.rb
174
+ - examples/config_initializers_highrise.rb
175
+ - examples/extending.rb
176
+ - examples/sample.rb