soleone-highrise 0.13.3

Sign up to get free protection for your applications and to get access to all the features.
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 @@
1
+ pkg/**
@@ -0,0 +1,91 @@
1
+ 2009-05-27 Ken Mayer <kmayer@bitwrangler.com>
2
+
3
+ * Version 0.12.0
4
+
5
+ * Added store_options attribute, so fetches will work work with
6
+ :mem_cache_store and :expires_in
7
+
8
+ 2009-05-20 Ken Mayer <kmayer@bitwrangler.com>
9
+
10
+ * Version 0.11.0
11
+
12
+ * Added untag_id! to Taggable, in case you already know the id and don't
13
+ need to search for it again.
14
+
15
+ 2009-05-16 Ken Mayer <kmayer@bitwrangler.com>
16
+
17
+ * Version 0.10.0
18
+
19
+ * Simplified caching store interface, left configuration up to end-user with
20
+ less magic
21
+
22
+ * Removed version.rb module & tests. No one will ever use it, why clutter up
23
+ the code.
24
+
25
+ 2009-05-05 Ken Mayer <kmayer@bitwrangler.com>
26
+
27
+ * Version 0.9.2
28
+
29
+ * Refactored cachable to be more idiomatic ruby
30
+
31
+ * Dropped the SHA1 hashing from cache_key
32
+
33
+ 2009-05-04 Ken Mayer <kmayer@bitwrangler.com>
34
+
35
+ * Version 0.9.0
36
+
37
+ * Changed cache_store= interface to accept :none (to disable caching),
38
+ :rails (to use the default Rails cache, whatever that happens to be), and,
39
+ consequently, restores the lookup_store default behavior (given nil or
40
+ empty options returns a new, default cache_store).
41
+
42
+ * Documentation update. Created and back-filled CHANGELOG
43
+
44
+ 2009-05-01 Ken Mayer <kmayer@bitwrangler.com>
45
+
46
+ * Version 0.8.0
47
+
48
+ * Added caching feature
49
+
50
+ * Added example code
51
+
52
+ * Documentation update
53
+
54
+ * Updated gemspec
55
+
56
+ 2009-04-26 Ken Mayer <kmayer@bitwrangler.com>
57
+
58
+ * Version 0.7.0
59
+
60
+ * Refactored Tag & Taggable so ::Tag is a subclass of Base. This adds
61
+ ::Tag.find(:all) to your quiver of tools. All existing functionality
62
+ passes tests, but the interface to ::Tag.new has changed. You have to
63
+ treat it like all of other ARes, that is, use a Hash (instead of
64
+ positional parameters) to initialize the model.
65
+
66
+ 2009-04-22 Luis Bepop
67
+
68
+ * Version 0.6.3
69
+
70
+ * Support to tags refactored. Include curl helper to improve support for
71
+ objects without ActiveResource base like 'tag' which needs a parse in a
72
+ html document from a httprequest.
73
+
74
+ 2009-04-06 slainer68
75
+
76
+ * Version 0.6.2
77
+
78
+ * Modularize Taggable
79
+
80
+ 2009-03-31 ThiagoLelis
81
+
82
+ * Version 0.6.1
83
+
84
+ * Add Person.tag that show a array of tags, and Perton.tag(name), add a new
85
+ tag to a person.
86
+
87
+ 2009-01-14 tapajos
88
+
89
+ * Version 0.5.0
90
+
91
+ * Initial import
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Ken Mayer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,86 @@
1
+ # Highrise (0.12.0)
2
+
3
+ ## What is it?
4
+
5
+ This gem provides a set of classes to access information on [Highrise][h] via the published [API][api]:
6
+
7
+ Comment, Company, Email, Group, Case, Membership, Note, Person, Subject, Tag, Task, User.
8
+
9
+ All these classes are inherited from ActiveResouce::Base. Refer to the [ActiveResouce][ar] documentation for more information.
10
+
11
+ ## Installing
12
+
13
+ gem install kmayer-highrise
14
+
15
+ ### Dependencies
16
+
17
+ * ActiveResorce >= 2.2.2
18
+ * ActiveSupport >= 2.1
19
+ * Curb
20
+ * Hpricot
21
+
22
+ ### Configure your key
23
+
24
+ require 'rubygems'
25
+ require 'highrise'
26
+
27
+ Highrise::Base.site = 'http://your_api:login@your_site.highrisehq.com/'
28
+
29
+ or
30
+
31
+ Highrise::Base.site = 'http://your_site.highrisehq.com'
32
+ Highrise::Base.user = 'api-auth-token'
33
+
34
+ and, if you want [caching][c]:
35
+
36
+ Highrise::Base.connection.cache_store= <your normal ActiveSupport::Caching options>
37
+
38
+ If you are using this in a Rails application, putting this code in a config/initializers/highrise.rb
39
+ file is recommended. See config_initializers_highrise.rb in the examples/ directory.
40
+
41
+ ## Usage
42
+
43
+ @tags = Highrise::Tag.find(:all)
44
+
45
+ @people = Highrise::Person.find_all_across_pages(:params => {:tag_id => 12345})
46
+
47
+ @person.tag!("VIP")
48
+
49
+ ## License
50
+
51
+ This code is free to be used under the terms of the [MIT license][mit].
52
+
53
+ ## Bugs, Issues, Kudos and Catcalls
54
+
55
+ Comments are welcome. Send your feedback through the [issue tracker on GitHub][i]
56
+
57
+ ## Contributors
58
+
59
+ * [Marcos Tapajós][mt]
60
+ * [Nicolas Bianco][nb]
61
+ * [Luis Gustavo][lg]
62
+ * [Thiago Lelis][tl]
63
+ * [Ken Mayer][km]
64
+
65
+ ## Special Thanks
66
+
67
+ [Rails Envy Podcast Episode #77][re] for mentioning
68
+ [How to Cache Anything With ActiveSupport][rh] on the very *day* I started writing the cache code. Thank you, Rein
69
+ for writing an excellent tutorial and [posting your source][e] on GitHub.
70
+
71
+ [api]: http://developer.37signals.com/highrise
72
+ [ar]: http://api.rubyonrails.org/classes/ActiveResource/Base.html
73
+ [c]: http://api.rubyonrails.org/classes/ActiveSupport/Cache
74
+ [co]: http://github.com/kmayer
75
+ [e]: http://github.com/primedia/endeca/tree/master
76
+ [h]: http://www.highrisehq.com/
77
+ [i]: http://github.com/kmayer/highrise/issues
78
+ [ii]: http://www.improveit.com.br/en
79
+ [km]: http://github.com/kmayer
80
+ [lg]: http://github.com/luisbebop
81
+ [mit]:http://www.opensource.org/licenses/mit-license.php
82
+ [mt]: http://www.improveit.com.br/en/company/tapajos
83
+ [nb]: http://github.com/slainer86
84
+ [re]: http://www.railsenvy.com/2009/4/29/rails-envy-podcast-episode-077-04-29-2009
85
+ [rh]: http://reinh.com/blog/2009/04/27/how-to-cache-anything-with-activesupport.html
86
+ [tl]: http://github.com/ThiagoLelis
@@ -0,0 +1,46 @@
1
+ require 'rake'
2
+ require 'rubygems'
3
+ require 'rake/rdoctask'
4
+ require 'rake/testtask'
5
+ require 'spec/rake/spectask'
6
+ require "date"
7
+ require "fileutils"
8
+ require "rubygems"
9
+ require "rake/gempackagetask"
10
+
11
+ begin
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gemspec|
14
+ gemspec.name = "highrise"
15
+ gemspec.summary = "Ruby wrapper around Highrise API"
16
+ gemspec.email = "kmayer@bitwrangler.com"
17
+ gemspec.homepage = "http://github.com/kmayer/highrise"
18
+ gemspec.description = %{
19
+ Based on the original API module from DHH, http://developer.37signals.com/highrise/, this
20
+ gem is a cleaned up, tested version of the same. Contributors have added support for tags
21
+ which are not supported by the API directly
22
+
23
+ Configure by adding the following:
24
+
25
+ require 'highrise'
26
+ Highrise::Base.site = 'http://your_site.highrisehq.com/'
27
+ Highrise::Base.user = 'your_api_auth_token'
28
+ }
29
+ gemspec.authors = ["Marcos Tapajós", "Ken Mayer"]
30
+ gemspec.add_dependency('activeresource', '>=2.2')
31
+ gemspec.add_dependency('activesupport', '>=2.1')
32
+ gemspec.add_dependency('curb')
33
+ gemspec.add_dependency('hpricot')
34
+ end
35
+ rescue LoadError
36
+ puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gems.github.com"
37
+ end
38
+
39
+ desc 'Default: run unit tests.'
40
+ task :default => :spec
41
+
42
+ desc "Run all specs"
43
+ Spec::Rake::SpecTask.new do |t|
44
+ t.spec_files = FileList['spec/**/*_spec.rb']
45
+ t.spec_opts = ['--options', 'spec/spec.opts']
46
+ end
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 13
3
+ :patch: 0
4
+ :major: 0
@@ -0,0 +1,3 @@
1
+ Autotest.add_discovery do
2
+ "rspec"
3
+ end
@@ -0,0 +1,12 @@
1
+ if Rails.env != 'test' then
2
+ Highrise::Base.site = 'https://example.com.i'
3
+ # For backward compatability
4
+ if Highrise::Base.respond_to? :user
5
+ Highrise::Base.user = 'my_fancy_auth_token'
6
+ else
7
+ Highrise::Base.site = 'https://my_fancy_auth_token@example.com.i'
8
+ end
9
+ # The cache store can be anything that ActiveSupport can handle
10
+ Highrise::Base.connection.cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store
11
+ Highrise::Base.connection.store_options = { :expires_in => 60.seconds }
12
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Example of extending a class when you need to synthesize an attribute.
3
+ #
4
+ # Adds Highrise::Person.{phone,fax,email} to the Person class inside your
5
+ # module
6
+ #
7
+
8
+ module MyModule
9
+ include Highrise
10
+
11
+ Highrise::Person.class_eval do
12
+ class << self
13
+ def lookup(id, list, item, location)
14
+ module_eval <<-EOT
15
+ def #{id}
16
+ contact_data.#{list}.each do |i|
17
+ return i.#{item}.strip if i.location == "#{location}"
18
+ end
19
+ ''
20
+ end
21
+ EOT
22
+ end
23
+
24
+ private :lookup
25
+ end
26
+
27
+ lookup(:phone, 'phone_numbers', 'number', 'Work')
28
+ lookup(:fax, 'phone_numbers', 'number', 'Fax')
29
+ lookup(:email, 'email_addresses', 'address', 'Work')
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ require 'highrise'
2
+ require 'pp'
3
+
4
+ Highrise::Base.site = 'https://yoursite.highrisehq.com'
5
+ Highrise::Base.user = 'xxx'
6
+ Highrise::Base.connection.cache_store = :memory_store
7
+
8
+ @tags = Highrise::Tag.find(:all)
9
+
10
+ pp @tags
@@ -0,0 +1,131 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{soleone-highrise}
5
+ s.version = "0.13.3"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Marcos Tapaj\303\263s", "Ken Mayer", "Dennis Theisen"]
9
+ s.date = %q{2009-05-29}
10
+ s.description = %q{
11
+ Based on the original API module from DHH, http://developer.37signals.com/highrise/, this
12
+ gem is a cleaned up, tested version of the same. Contributors have added support for tags
13
+ which are not supported by the API directly
14
+
15
+ Configure by adding the following:
16
+
17
+ require 'highrise'
18
+ Highrise::Base.site = 'http://your_site.highrisehq.com/'
19
+ Highrise::Base.user = 'your_api_auth_token'
20
+ }
21
+ s.email = %q{kmayer@bitwrangler.com}
22
+ s.extra_rdoc_files = [
23
+ "README.mkdn"
24
+ ]
25
+ s.files = [
26
+ ".gitignore",
27
+ "CHANGELOG",
28
+ "MIT-LICENSE",
29
+ "README.mkdn",
30
+ "Rakefile",
31
+ "VERSION.yml",
32
+ "autotest/discover.rb",
33
+ "examples/config_initializers_highrise.rb",
34
+ "examples/extending.rb",
35
+ "examples/sample.rb",
36
+ "highrise.gemspec",
37
+ "install.rb",
38
+ "lib/cachable.rb",
39
+ "lib/highrise.rb",
40
+ "lib/highrise/base.rb",
41
+ "lib/highrise/comment.rb",
42
+ "lib/highrise/company.rb",
43
+ "lib/highrise/curlhelper.rb",
44
+ "lib/highrise/curly.rb",
45
+ "lib/highrise/deal.rb",
46
+ "lib/highrise/email.rb",
47
+ "lib/highrise/group.rb",
48
+ "lib/highrise/kase.rb",
49
+ "lib/highrise/membership.rb",
50
+ "lib/highrise/note.rb",
51
+ "lib/highrise/pagination.rb",
52
+ "lib/highrise/person.rb",
53
+ "lib/highrise/subject.rb",
54
+ "lib/highrise/tag.rb",
55
+ "lib/highrise/taggable.rb",
56
+ "lib/highrise/task.rb",
57
+ "lib/highrise/user.rb",
58
+ "spec/cachable_spec.rb",
59
+ "spec/highrise/base_spec.rb",
60
+ "spec/highrise/comment_spec.rb",
61
+ "spec/highrise/companies/16883216.html",
62
+ "spec/highrise/company_spec.rb",
63
+ "spec/highrise/curlhelper_spec.rb",
64
+ "spec/highrise/curly_spec.rb",
65
+ "spec/highrise/email_spec.rb",
66
+ "spec/highrise/group_spec.rb",
67
+ "spec/highrise/kase_spec.rb",
68
+ "spec/highrise/membership_spec.rb",
69
+ "spec/highrise/note_spec.rb",
70
+ "spec/highrise/pagination_spec.rb",
71
+ "spec/highrise/people/16887003.html",
72
+ "spec/highrise/person_spec.rb",
73
+ "spec/highrise/subject_spec.rb",
74
+ "spec/highrise/tag_spec.rb",
75
+ "spec/highrise/task_spec.rb",
76
+ "spec/highrise/user_spec.rb",
77
+ "spec/spec.opts",
78
+ "spec/spec_helper.rb",
79
+ "uninstall.rb"
80
+ ]
81
+ s.homepage = %q{http://github.com/kmayer/highrise}
82
+ s.rdoc_options = ["--charset=UTF-8"]
83
+ s.require_paths = ["lib"]
84
+ s.rubygems_version = %q{1.3.3}
85
+ s.summary = %q{Ruby wrapper around Highrise API}
86
+ s.test_files = [
87
+ "spec/cachable_spec.rb",
88
+ "spec/highrise/base_spec.rb",
89
+ "spec/highrise/comment_spec.rb",
90
+ "spec/highrise/company_spec.rb",
91
+ "spec/highrise/curlhelper_spec.rb",
92
+ "spec/highrise/curly_spec.rb",
93
+ "spec/highrise/email_spec.rb",
94
+ "spec/highrise/group_spec.rb",
95
+ "spec/highrise/kase_spec.rb",
96
+ "spec/highrise/membership_spec.rb",
97
+ "spec/highrise/note_spec.rb",
98
+ "spec/highrise/pagination_spec.rb",
99
+ "spec/highrise/person_spec.rb",
100
+ "spec/highrise/subject_spec.rb",
101
+ "spec/highrise/tag_spec.rb",
102
+ "spec/highrise/task_spec.rb",
103
+ "spec/highrise/user_spec.rb",
104
+ "spec/spec_helper.rb",
105
+ "examples/config_initializers_highrise.rb",
106
+ "examples/extending.rb",
107
+ "examples/sample.rb"
108
+ ]
109
+
110
+ if s.respond_to? :specification_version then
111
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
112
+ s.specification_version = 3
113
+
114
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
115
+ s.add_runtime_dependency(%q<activeresource>, [">= 2.2"])
116
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.1"])
117
+ s.add_runtime_dependency(%q<curb>, [">= 0"])
118
+ s.add_runtime_dependency(%q<hpricot>, [">= 0"])
119
+ else
120
+ s.add_dependency(%q<activeresource>, [">= 2.2"])
121
+ s.add_dependency(%q<activesupport>, [">= 2.1"])
122
+ s.add_dependency(%q<curb>, [">= 0"])
123
+ s.add_dependency(%q<hpricot>, [">= 0"])
124
+ end
125
+ else
126
+ s.add_dependency(%q<activeresource>, [">= 2.2"])
127
+ s.add_dependency(%q<activesupport>, [">= 2.1"])
128
+ s.add_dependency(%q<curb>, [">= 0"])
129
+ s.add_dependency(%q<hpricot>, [">= 0"])
130
+ end
131
+ end