highrise 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.8.7
4
+ - ree-1.8.7
5
+ # branches:
6
+ # only:
7
+ # - master
@@ -1,23 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- highrise (3.0.0.pre04)
5
- activeresource (~> 3.0.0)
4
+ highrise (3.0.1)
5
+ activeresource (~> 3.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- activemodel (3.0.1)
11
- activesupport (= 3.0.1)
12
- builder (~> 2.1.2)
13
- i18n (~> 0.4.1)
14
- activeresource (3.0.1)
15
- activemodel (= 3.0.1)
16
- activesupport (= 3.0.1)
17
- activesupport (3.0.1)
18
- builder (2.1.2)
10
+ activemodel (3.1.0)
11
+ activesupport (= 3.1.0)
12
+ bcrypt-ruby (~> 3.0.0)
13
+ builder (~> 3.0.0)
14
+ i18n (~> 0.6)
15
+ activeresource (3.1.0)
16
+ activemodel (= 3.1.0)
17
+ activesupport (= 3.1.0)
18
+ activesupport (3.1.0)
19
+ multi_json (~> 1.0)
20
+ bcrypt-ruby (3.0.0)
21
+ builder (3.0.0)
19
22
  diff-lcs (1.1.2)
20
- i18n (0.4.2)
23
+ i18n (0.6.0)
24
+ multi_json (1.0.3)
25
+ rake (0.8.7)
21
26
  rspec (2.0.1)
22
27
  rspec-core (~> 2.0.1)
23
28
  rspec-expectations (~> 2.0.1)
@@ -33,6 +38,6 @@ PLATFORMS
33
38
  ruby
34
39
 
35
40
  DEPENDENCIES
36
- activeresource (~> 3.0.0)
37
41
  highrise!
38
- rspec
42
+ rake (= 0.8.7)
43
+ rspec (~> 2.0.1)
@@ -1,4 +1,4 @@
1
- # Highrise (3.0.0)
1
+ # Highrise (3.0.0) [![Build Status](https://secure.travis-ci.org/tapajos/highrise.png)](http://travis-ci.org/tapajos/highrise)
2
2
 
3
3
  ## What is it?
4
4
 
@@ -22,7 +22,7 @@ All these classes are inherited from ActiveResouce::Base. Refer to the [ActiveRe
22
22
 
23
23
  require 'highrise'
24
24
 
25
- Highrise::Base.site = 'http://your_site.highrisehq.com'
25
+ Highrise::Base.site = 'https://your_site.highrisehq.com'
26
26
  Highrise::Base.user = 'api-auth-token'
27
27
 
28
28
  If you are using this in a Rails application, putting this code in a config/initializers/highrise.rb
@@ -59,7 +59,7 @@ version file.
59
59
  * [Thiago Lelis][ThiagoLelis]
60
60
  * [Denis Odorcic][odorcicd]
61
61
 
62
- ## References
62
+
63
63
 
64
64
  [api]: http://developer.37signals.com/highrise
65
65
  [ar]: http://api.rubyonrails.org/classes/ActiveResource/Base.html
@@ -67,10 +67,10 @@ version file.
67
67
  [h]: http://www.highrisehq.com/
68
68
  [i]: https://github.com/tapajos/highrise/issues
69
69
  [kmayer]: https://github.com/kmayer
70
- [lg]: https://github.com/luisbebop
70
+ [luisbebop]: https://github.com/luisbebop
71
71
  [mit]:http://www.opensource.org/licenses/mit-license.php
72
- [nb]: https://github.com/slainer86
72
+ [slainer86]: https://github.com/slainer86
73
73
  [odorcicd]: https://github.com/odorcicd
74
74
  [rdoc]: http://rdoc.info/projects/tapajos/highrise
75
75
  [tapajos]: http://www.improveit.com.br/en/company/tapajos
76
- [tl]: https://github.com/ThiagoLelis
76
+ [ThiagoLelis]: https://github.com/ThiagoLelis
@@ -8,10 +8,11 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
 
10
10
  s.required_rubygems_version = ">= 1.3.6"
11
- s.add_dependency "activeresource", "~>3.0.0"
12
- s.add_development_dependency "rspec"
11
+ s.add_dependency "activeresource", "~>3.0"
12
+ s.add_development_dependency "rspec", "~>2.0.1"
13
+ s.add_development_dependency "rake", "=0.8.7"
13
14
 
14
- s.files = `git ls-files`.split("\n")
15
+ s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features,examples}/*`.split("\n")
16
17
  s.require_paths = ["lib"]
17
18
 
@@ -29,5 +30,4 @@ Gem::Specification.new do |s|
29
30
  Highrise::Base.site = 'http://your_site.highrisehq.com/'
30
31
  Highrise::Base.user = 'your_api_auth_token'
31
32
  EOT
32
-
33
33
  end
@@ -4,10 +4,6 @@ module Highrise
4
4
  include Taggable
5
5
  include Searchable
6
6
 
7
- def self.find_all_across_pages_since(time)
8
- find_all_across_pages(:params => { :since => time.utc.strftime("%Y%m%d%H%M%S") })
9
- end
10
-
11
7
  def people
12
8
  Person.find_all_across_pages(:from => "/companies/#{id}/people.xml")
13
9
  end
@@ -16,6 +16,21 @@ module Highrise
16
16
  find_all_across_pages(:params => { :since => time.utc.strftime("%Y%m%d%H%M%S") })
17
17
  end
18
18
 
19
+ # This is useful only for Company, Person, Note, Comment, Email and Task, but should be safely ignored by other classes
20
+ def find_all_deletions_across_pages(options = {})
21
+ # point to the global deletions feed
22
+ options[:from] = '/deletions.xml'
23
+
24
+ records = []
25
+ each_deletions(options) { |record| records << record }
26
+ records
27
+ end
28
+
29
+ # This is useful only for Company, Person, Note, Comment, Email and Task, but should be safely ignored by other classes
30
+ def find_all_deletions_across_pages_since(time)
31
+ find_all_deletions_across_pages(:params => { :since => time.utc.strftime("%Y%m%d%H%M%S") })
32
+ end
33
+
19
34
  private
20
35
 
21
36
  def each(options = {})
@@ -31,6 +46,27 @@ module Highrise
31
46
  end
32
47
  end
33
48
  end
49
+
50
+ def each_deletions(options = {})
51
+ options[:params] ||= {}
52
+ # first index for deletions is 1
53
+ options[:params][:n] = 1
54
+
55
+ loop do
56
+ if (records = self.find(:all, options)).try(:any?)
57
+ # reject the records whose resource type is different from self
58
+ records.reject!{|r| r.class.to_s.split('::').last != self.to_s.split('::').last}
59
+
60
+ records.each{ |record| yield record }
61
+
62
+ # index increment for deletions is 1 per page of 500 resources
63
+ options[:params][:n] += 1
64
+ else
65
+ break # no deletions included on that page, thus no more deletions
66
+ end
67
+ end
68
+ end
69
+
34
70
  end
35
71
  end
36
- end
72
+ end
@@ -1,3 +1,3 @@
1
1
  module Highrise
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
@@ -17,4 +17,34 @@ shared_examples_for "a paginated class" do
17
17
  subject.class.should_receive(:find_all_across_pages).with({:params=>{:since=>"20090114174311"}}).and_return("result")
18
18
  subject.class.find_all_across_pages_since(time).should == "result"
19
19
  end
20
+
21
+ it ".find_all_deletions_across_pages" do
22
+ class TestClass2 < Highrise::Base; include Highrise::Pagination; end
23
+ subject_type = subject.class.to_s.split('::').last
24
+ deleted_resource_1 = subject.class.new(:id => 12, :type => subject_type)
25
+ deleted_resource_2 = TestClass2.new(:id => 34, :type => 'TestClass2')
26
+ deleted_resource_3 = subject.class.new(:id => 45, :type => subject_type)
27
+
28
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>1}}).and_return([deleted_resource_1, deleted_resource_2, deleted_resource_3])
29
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>2}}).and_return([])
30
+ subject.class.find_all_deletions_across_pages.should == [deleted_resource_1, deleted_resource_3]
31
+ end
32
+
33
+ it ".find_all_deletions_across_pages with zero results" do
34
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>1}}).and_return(nil)
35
+ subject.class.find_all_deletions_across_pages.should == []
36
+ end
37
+
38
+ it ".find_all_deletions_across_pages_since" do
39
+ class TestClass2 < Highrise::Base; include Highrise::Pagination; end
40
+ subject_type = subject.class.to_s.split('::').last
41
+ time = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
42
+ deleted_resource_1 = subject.class.new(:id => 12, :type => subject_type)
43
+ deleted_resource_2 = TestClass2.new(:id => 34, :type => 'TestClass2')
44
+ deleted_resource_3 = subject.class.new(:id => 45, :type => subject_type)
45
+
46
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>1, :since=>"20090114174311"}}).and_return([deleted_resource_1, deleted_resource_2, deleted_resource_3])
47
+ subject.class.should_receive(:find).with(:all,{:from => '/deletions.xml', :params=>{:n=>2, :since=>"20090114174311"}}).and_return([])
48
+ subject.class.find_all_deletions_across_pages_since(time).should == [deleted_resource_1, deleted_resource_3]
49
+ end
20
50
  end
@@ -10,12 +10,6 @@ describe Highrise::Person do
10
10
  it_should_behave_like "a taggable class"
11
11
  it_should_behave_like "a searchable class"
12
12
 
13
- it ".find_all_across_pages_since" do
14
- mocked_now = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
15
- Highrise::Person.should_receive(:find_all_across_pages).with({:params=>{:since=>"20090114174311"}}).and_return("result")
16
- Highrise::Person.find_all_across_pages_since(mocked_now).should == "result"
17
- end
18
-
19
13
  describe "#company" do
20
14
  it "returns nil when it doesn't have a company" do
21
15
  subject.should_receive(:company_id).and_return(nil)
@@ -4,10 +4,4 @@ describe Highrise::Recording do
4
4
  it { should be_a_kind_of Highrise::Base }
5
5
 
6
6
  it_should_behave_like "a paginated class"
7
-
8
- it ".find_all_across_pages_since" do
9
- time = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
10
- Highrise::Recording.should_receive(:find_all_across_pages).with({:params=>{:since=>"20090114174311"}}).and_return("result")
11
- Highrise::Recording.find_all_across_pages_since(time).should == "result"
12
- end
13
7
  end
@@ -4,7 +4,7 @@ Bundler.setup
4
4
  require File.join(File.dirname(__FILE__), '/../lib/highrise')
5
5
 
6
6
  Highrise::Base.user = ENV['HIGHRISE_USER'] || 'x'
7
- Highrise::Base.site = ENV['HIGHRISE_SITE'] || 'http://www.example.com'
7
+ Highrise::Base.site = ENV['HIGHRISE_SITE'] || 'https://www.example.com'
8
8
 
9
9
  require 'highrise/pagination_behavior'
10
10
  require 'highrise/searchable_behavior'
metadata CHANGED
@@ -1,70 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: highrise
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
6
- segments:
7
- - 3
8
- - 0
9
- - 0
10
- version: 3.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
13
- - "Marcos Tapaj\xC3\xB3s"
7
+ authors:
8
+ - Marcos Tapajós
14
9
  - Ken Mayer
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2010-11-06 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ date: 2011-08-31 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  name: activeresource
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2153906540 !ruby/object:Gem::Requirement
26
18
  none: false
27
- requirements:
19
+ requirements:
28
20
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 7
31
- segments:
32
- - 3
33
- - 0
34
- - 0
35
- version: 3.0.0
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
36
23
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
24
+ prerelease: false
25
+ version_requirements: *2153906540
26
+ - !ruby/object:Gem::Dependency
39
27
  name: rspec
28
+ requirement: &2153905960 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.1
34
+ type: :development
40
35
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: *2153905960
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ requirement: &2153905380 !ruby/object:Gem::Requirement
42
40
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
41
+ requirements:
42
+ - - =
43
+ - !ruby/object:Gem::Version
44
+ version: 0.8.7
50
45
  type: :development
51
- version_requirements: *id002
52
- description: " Based on the original API module from DHH, http://developer.37signals.com/highrise/, this\n gem is a cleaned up, tested version of the same. \n\n Configure by adding the following:\n\n require 'highrise'\n Highrise::Base.site = 'http://your_site.highrisehq.com/'\n Highrise::Base.user = 'your_api_auth_token'\n"
53
- email:
46
+ prerelease: false
47
+ version_requirements: *2153905380
48
+ description: ! " Based on the original API module from DHH, http://developer.37signals.com/highrise/,
49
+ this\n gem is a cleaned up, tested version of the same. \n\n Configure by
50
+ adding the following:\n\n require 'highrise'\n Highrise::Base.site = 'http://your_site.highrisehq.com/'\n
51
+ \ Highrise::Base.user = 'your_api_auth_token'\n"
52
+ email:
54
53
  - marcos@tapajos.me
55
54
  - kmayer@bitwrangler.com
56
55
  executables: []
57
-
58
56
  extensions: []
59
-
60
57
  extra_rdoc_files: []
61
-
62
- files:
58
+ files:
63
59
  - .gitignore
60
+ - .travis.yml
64
61
  - Gemfile
65
62
  - Gemfile.lock
66
63
  - MIT-LICENSE
67
- - README.mkdn
64
+ - README.md
68
65
  - Rakefile
69
66
  - autotest/discover.rb
70
67
  - examples/config_initializers_highrise.rb
@@ -121,43 +118,34 @@ files:
121
118
  - spec/highrise/task_spec.rb
122
119
  - spec/highrise/user_spec.rb
123
120
  - spec/spec_helper.rb
124
- has_rdoc: true
125
121
  homepage: http://github.com/tapajos/highrise
126
122
  licenses: []
127
-
128
123
  post_install_message:
129
124
  rdoc_options: []
130
-
131
- require_paths:
125
+ require_paths:
132
126
  - lib
133
- required_ruby_version: !ruby/object:Gem::Requirement
127
+ required_ruby_version: !ruby/object:Gem::Requirement
134
128
  none: false
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- hash: 3
139
- segments:
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ segments:
140
134
  - 0
141
- version: "0"
142
- required_rubygems_version: !ruby/object:Gem::Requirement
135
+ hash: -677915891012339323
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
137
  none: false
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- hash: 23
148
- segments:
149
- - 1
150
- - 3
151
- - 6
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
152
141
  version: 1.3.6
153
142
  requirements: []
154
-
155
143
  rubyforge_project:
156
- rubygems_version: 1.3.7
144
+ rubygems_version: 1.8.10
157
145
  signing_key:
158
146
  specification_version: 3
159
147
  summary: Ruby wrapper around Highrise API
160
- test_files:
148
+ test_files:
161
149
  - examples/config_initializers_highrise.rb
162
150
  - examples/extending.rb
163
151
  - examples/sample.rb