highrise 3.1.6 → 3.2.1
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +1 -1
- data/highrise.gemspec +3 -3
- data/highrise.gemspec.erb +2 -2
- data/lib/highrise.rb +2 -0
- data/lib/highrise/person.rb +63 -4
- data/lib/highrise/subject_data.rb +8 -0
- data/lib/highrise/subject_field.rb +26 -0
- data/lib/highrise/taggable.rb +1 -1
- data/lib/highrise/version.rb +1 -1
- data/spec/highrise/person_spec.rb +67 -0
- data/spec/highrise/subject_data_spec.rb +24 -0
- data/spec/highrise/subject_field_spec.rb +46 -0
- data/spec/spec_helper.rb +2 -0
- metadata +10 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71cd31f6f19cdaccbfee0fe9d620698930bdb284
|
|
4
|
+
data.tar.gz: 17e30e6d078c224e3c4b0d664e3a24fd2dfc1932
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8bbd1dfa7c07273b73c00d078f98f405c209f3fa77b6eefa0dbd44afb57ab63bdf2d919b359356f0e13f8327dd6cc5224b51de2277f7fafec1e3f94ccaa14b09
|
|
7
|
+
data.tar.gz: 53891509f8ede23d45abe6e9f78de34c2784162c8fffd414a3d068ec5677234e722efbe0f5f5ee55d5344dd169c5b957c579baad21963f04b52b36b026e2c196
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.0-p247
|
data/Gemfile.lock
CHANGED
data/highrise.gemspec
CHANGED
|
@@ -12,13 +12,13 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.add_development_dependency "rspec"
|
|
13
13
|
s.add_development_dependency "rake"
|
|
14
14
|
|
|
15
|
-
s.files = [".gitignore", ".travis.yml", "Gemfile", "Gemfile.lock", "MIT-LICENSE", "README.md", "Rakefile", "autotest/discover.rb", "certs/gem-public_cert.pem", "examples/config_initializers_highrise.rb", "examples/extending.rb", "examples/sample.rb", "highrise.gemspec", "highrise.gemspec.erb", "lib/highrise.rb", "lib/highrise/account.rb", "lib/highrise/base.rb", "lib/highrise/comment.rb", "lib/highrise/company.rb", "lib/highrise/deal.rb", "lib/highrise/deal_category.rb", "lib/highrise/email.rb", "lib/highrise/group.rb", "lib/highrise/kase.rb", "lib/highrise/membership.rb", "lib/highrise/note.rb", "lib/highrise/pagination.rb", "lib/highrise/party.rb", "lib/highrise/person.rb", "lib/highrise/recording.rb", "lib/highrise/searchable.rb", "lib/highrise/subject.rb", "lib/highrise/tag.rb", "lib/highrise/taggable.rb", "lib/highrise/task.rb", "lib/highrise/task_category.rb", "lib/highrise/user.rb", "lib/highrise/version.rb", "spec/highrise/account_spec.rb", "spec/highrise/base_spec.rb", "spec/highrise/comment_spec.rb", "spec/highrise/company_spec.rb", "spec/highrise/deal_category_spec.rb", "spec/highrise/deal_spec.rb", "spec/highrise/email_spec.rb", "spec/highrise/group_spec.rb", "spec/highrise/kase_spec.rb", "spec/highrise/membership_spec.rb", "spec/highrise/note_spec.rb", "spec/highrise/pagination_behavior.rb", "spec/highrise/pagination_spec.rb", "spec/highrise/party_spec.rb", "spec/highrise/person_spec.rb", "spec/highrise/recording_spec.rb", "spec/highrise/searchable_behavior.rb", "spec/highrise/searchable_spec.rb", "spec/highrise/subject_spec.rb", "spec/highrise/tag_spec.rb", "spec/highrise/taggable_behavior.rb", "spec/highrise/taggable_spec.rb", "spec/highrise/task_category_spec.rb", "spec/highrise/task_spec.rb", "spec/highrise/user_spec.rb", "spec/spec_helper.rb"]
|
|
16
|
-
s.test_files = ["examples/config_initializers_highrise.rb", "examples/extending.rb", "examples/sample.rb", "spec/highrise/account_spec.rb", "spec/highrise/base_spec.rb", "spec/highrise/comment_spec.rb", "spec/highrise/company_spec.rb", "spec/highrise/deal_category_spec.rb", "spec/highrise/deal_spec.rb", "spec/highrise/email_spec.rb", "spec/highrise/group_spec.rb", "spec/highrise/kase_spec.rb", "spec/highrise/membership_spec.rb", "spec/highrise/note_spec.rb", "spec/highrise/pagination_behavior.rb", "spec/highrise/pagination_spec.rb", "spec/highrise/party_spec.rb", "spec/highrise/person_spec.rb", "spec/highrise/recording_spec.rb", "spec/highrise/searchable_behavior.rb", "spec/highrise/searchable_spec.rb", "spec/highrise/subject_spec.rb", "spec/highrise/tag_spec.rb", "spec/highrise/taggable_behavior.rb", "spec/highrise/taggable_spec.rb", "spec/highrise/task_category_spec.rb", "spec/highrise/task_spec.rb", "spec/highrise/user_spec.rb", "spec/spec_helper.rb"]
|
|
15
|
+
s.files = [".gitignore", ".ruby-version", ".travis.yml", "Gemfile", "Gemfile.lock", "MIT-LICENSE", "README.md", "Rakefile", "autotest/discover.rb", "certs/gem-public_cert.pem", "examples/config_initializers_highrise.rb", "examples/extending.rb", "examples/sample.rb", "highrise.gemspec", "highrise.gemspec.erb", "lib/highrise.rb", "lib/highrise/account.rb", "lib/highrise/base.rb", "lib/highrise/comment.rb", "lib/highrise/company.rb", "lib/highrise/deal.rb", "lib/highrise/deal_category.rb", "lib/highrise/email.rb", "lib/highrise/group.rb", "lib/highrise/kase.rb", "lib/highrise/membership.rb", "lib/highrise/note.rb", "lib/highrise/pagination.rb", "lib/highrise/party.rb", "lib/highrise/person.rb", "lib/highrise/recording.rb", "lib/highrise/searchable.rb", "lib/highrise/subject.rb", "lib/highrise/subject_data.rb", "lib/highrise/subject_field.rb", "lib/highrise/tag.rb", "lib/highrise/taggable.rb", "lib/highrise/task.rb", "lib/highrise/task_category.rb", "lib/highrise/user.rb", "lib/highrise/version.rb", "spec/highrise/account_spec.rb", "spec/highrise/base_spec.rb", "spec/highrise/comment_spec.rb", "spec/highrise/company_spec.rb", "spec/highrise/deal_category_spec.rb", "spec/highrise/deal_spec.rb", "spec/highrise/email_spec.rb", "spec/highrise/group_spec.rb", "spec/highrise/kase_spec.rb", "spec/highrise/membership_spec.rb", "spec/highrise/note_spec.rb", "spec/highrise/pagination_behavior.rb", "spec/highrise/pagination_spec.rb", "spec/highrise/party_spec.rb", "spec/highrise/person_spec.rb", "spec/highrise/recording_spec.rb", "spec/highrise/searchable_behavior.rb", "spec/highrise/searchable_spec.rb", "spec/highrise/subject_data_spec.rb", "spec/highrise/subject_field_spec.rb", "spec/highrise/subject_spec.rb", "spec/highrise/tag_spec.rb", "spec/highrise/taggable_behavior.rb", "spec/highrise/taggable_spec.rb", "spec/highrise/task_category_spec.rb", "spec/highrise/task_spec.rb", "spec/highrise/user_spec.rb", "spec/spec_helper.rb"]
|
|
16
|
+
s.test_files = ["examples/config_initializers_highrise.rb", "examples/extending.rb", "examples/sample.rb", "spec/highrise/account_spec.rb", "spec/highrise/base_spec.rb", "spec/highrise/comment_spec.rb", "spec/highrise/company_spec.rb", "spec/highrise/deal_category_spec.rb", "spec/highrise/deal_spec.rb", "spec/highrise/email_spec.rb", "spec/highrise/group_spec.rb", "spec/highrise/kase_spec.rb", "spec/highrise/membership_spec.rb", "spec/highrise/note_spec.rb", "spec/highrise/pagination_behavior.rb", "spec/highrise/pagination_spec.rb", "spec/highrise/party_spec.rb", "spec/highrise/person_spec.rb", "spec/highrise/recording_spec.rb", "spec/highrise/searchable_behavior.rb", "spec/highrise/searchable_spec.rb", "spec/highrise/subject_data_spec.rb", "spec/highrise/subject_field_spec.rb", "spec/highrise/subject_spec.rb", "spec/highrise/tag_spec.rb", "spec/highrise/taggable_behavior.rb", "spec/highrise/taggable_spec.rb", "spec/highrise/task_category_spec.rb", "spec/highrise/task_spec.rb", "spec/highrise/user_spec.rb", "spec/spec_helper.rb"]
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
18
|
|
|
19
19
|
s.authors = ["Marcos Tapaj\303\263s", "Ken Mayer"]
|
|
20
20
|
s.email = ["marcos@tapajos.me", "kmayer@bitwrangler.com"]
|
|
21
|
-
s.homepage = "http://github.com/
|
|
21
|
+
s.homepage = "http://github.com/tapajos/highrise"
|
|
22
22
|
s.summary = "Ruby wrapper around Highrise API"
|
|
23
23
|
s.description = <<-EOT
|
|
24
24
|
Based on the original API module from DHH, http://developer.37signals.com/highrise/, this
|
data/highrise.gemspec.erb
CHANGED
|
@@ -8,7 +8,7 @@ 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", "
|
|
11
|
+
s.add_dependency "activeresource", ">= 3.2.13"
|
|
12
12
|
s.add_development_dependency "rspec"
|
|
13
13
|
s.add_development_dependency "rake"
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
|
|
19
19
|
s.authors = ["Marcos Tapaj\303\263s", "Ken Mayer"]
|
|
20
20
|
s.email = ["marcos@tapajos.me", "kmayer@bitwrangler.com"]
|
|
21
|
-
s.homepage = "http://github.com/
|
|
21
|
+
s.homepage = "http://github.com/tapajos/highrise"
|
|
22
22
|
s.summary = "Ruby wrapper around Highrise API"
|
|
23
23
|
s.description = <<-EOT
|
|
24
24
|
Based on the original API module from DHH, http://developer.37signals.com/highrise/, this
|
data/lib/highrise.rb
CHANGED
data/lib/highrise/person.rb
CHANGED
|
@@ -4,10 +4,6 @@ module Highrise
|
|
|
4
4
|
include Taggable
|
|
5
5
|
include Searchable
|
|
6
6
|
|
|
7
|
-
def tags
|
|
8
|
-
self.attributes.has_key?("tags") ? self.attributes["tags"] : super
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
def company
|
|
12
8
|
Company.find(company_id) if company_id
|
|
13
9
|
end
|
|
@@ -27,5 +23,68 @@ module Highrise
|
|
|
27
23
|
def label
|
|
28
24
|
'Party'
|
|
29
25
|
end
|
|
26
|
+
|
|
27
|
+
def field(field_label)
|
|
28
|
+
custom_fields = attributes["subject_datas"] ||= []
|
|
29
|
+
field = custom_fields.detect do |field|
|
|
30
|
+
field.subject_field_label == field_label
|
|
31
|
+
end
|
|
32
|
+
field ? field.value : nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def new_subject_data(field, value)
|
|
36
|
+
Highrise::SubjectData.new(:subject_field_id => field.id, :subject_field_label => field.label, :value => value)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def set_field_value(field_label, new_value)
|
|
40
|
+
custom_fields = attributes["subject_datas"] ||= []
|
|
41
|
+
custom_fields.each do |field|
|
|
42
|
+
return field.value = new_value if field.subject_field_label== field_label
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
SubjectField.find(:all).each do |custom_field|
|
|
46
|
+
if custom_field.label == field_label
|
|
47
|
+
return attributes["subject_datas"] << new_subject_data(custom_field, new_value)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def transform_subject_field_label field_label
|
|
53
|
+
field_label.downcase.tr(' ', '_')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def convert_method_to_field_label method
|
|
57
|
+
custom_fields = attributes["subject_datas"] ||= []
|
|
58
|
+
custom_fields.each do |field|
|
|
59
|
+
method_name_from_field = transform_subject_field_label(field.subject_field_label)
|
|
60
|
+
return field if method_name_from_field == method
|
|
61
|
+
end
|
|
62
|
+
nil
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def method_missing(method_symbol, *args)
|
|
66
|
+
method_name = method_symbol.to_s
|
|
67
|
+
|
|
68
|
+
if method_name[-1,1] == "="
|
|
69
|
+
attribute_name = method_name[0...-1]
|
|
70
|
+
field = convert_method_to_field_label(attribute_name)
|
|
71
|
+
return set_field_value(field.subject_field_label, args[0]) if field
|
|
72
|
+
|
|
73
|
+
return super if attributes[attribute_name]
|
|
74
|
+
|
|
75
|
+
subject_fields = SubjectField.find(:all)
|
|
76
|
+
unless subject_fields.nil?
|
|
77
|
+
subject_fields.each do |custom_field|
|
|
78
|
+
if transform_subject_field_label(custom_field.label) == attribute_name
|
|
79
|
+
return attributes["subject_datas"] << new_subject_data(custom_field, args[0])
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
else
|
|
84
|
+
field = convert_method_to_field_label(method_name)
|
|
85
|
+
return field(field.subject_field_label) if field
|
|
86
|
+
end
|
|
87
|
+
super
|
|
88
|
+
end
|
|
30
89
|
end
|
|
31
90
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Highrise
|
|
2
|
+
class SubjectField < Base
|
|
3
|
+
|
|
4
|
+
def initialize(attributes = {}, persisted = false)
|
|
5
|
+
super
|
|
6
|
+
@use_cache = false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.use_cache(use_cache = true)
|
|
10
|
+
@use_cache = use_cache
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.find_every(options)
|
|
14
|
+
if @use_cache
|
|
15
|
+
@subject_field_cache ||= super
|
|
16
|
+
else
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.invalidate_cache
|
|
22
|
+
@subject_field_cache = nil
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
data/lib/highrise/taggable.rb
CHANGED
data/lib/highrise/version.rb
CHANGED
|
@@ -42,6 +42,73 @@ describe Highrise::Person do
|
|
|
42
42
|
subject.tags.should == @tags
|
|
43
43
|
}
|
|
44
44
|
end
|
|
45
|
+
|
|
46
|
+
describe "Custom fields" do
|
|
47
|
+
|
|
48
|
+
before (:each) do
|
|
49
|
+
@fruit_person = Highrise::Person.new({ :person => {
|
|
50
|
+
:id => 1,
|
|
51
|
+
:first_name => "John",
|
|
52
|
+
:last_name => "Doe",
|
|
53
|
+
:subject_datas => [{
|
|
54
|
+
:subject_field_label => "Fruit Banana",
|
|
55
|
+
:value => "Yellow"
|
|
56
|
+
}, {
|
|
57
|
+
:subject_field_label => "Fruit Grape",
|
|
58
|
+
:value => "Green"
|
|
59
|
+
}]
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
@subject_field_blueberry = Highrise::SubjectField.new ({:id => 1, :label => "Fruit Blueberry"})
|
|
63
|
+
@subject_field_papaya = Highrise::SubjectField.new ({:id => 2, :label => "Fruit Papaya"})
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "Can get the value of a custom field via the field method" do
|
|
67
|
+
@fruit_person.field("Fruit Banana").should== "Yellow"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "Can get the value of a custom field using a custom method call" do
|
|
71
|
+
@fruit_person.fruit_grape.should== "Green"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "Will raise an exception on an unknown field" do
|
|
75
|
+
expect {@fruit_person.unknown_fruit}.to raise_exception(NoMethodError)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "Can set the value of a custom field via the field method" do
|
|
79
|
+
@fruit_person.set_field_value("Fruit Grape", "Red")
|
|
80
|
+
@fruit_person.field("Fruit Grape").should== "Red"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "Can set the value of a custom field" do
|
|
84
|
+
@fruit_person.fruit_grape= "Red"
|
|
85
|
+
@fruit_person.fruit_grape.should== "Red"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "Assignment just returns the arguments (like ActiveResource base does)" do
|
|
89
|
+
Highrise::SubjectField.should_receive(:find).with(:all).and_return []
|
|
90
|
+
(@fruit_person.unknown_fruit = 10).should== 10
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "Can deal with the find returning nil (which is a bit ugly in the ActiveResource API)" do
|
|
94
|
+
Highrise::SubjectField.should_receive(:find).with(:all).and_return nil
|
|
95
|
+
(@fruit_person.unknown_fruit = 10).should== 10
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "Can set the value of a custom field that wasn't there via the field method, but that was defined (happens on new Person)" do
|
|
99
|
+
Highrise::SubjectField.should_receive(:find).with(:all).and_return([@subject_field_papaya, @subject_field_blueberry])
|
|
100
|
+
@fruit_person.set_field_value("Fruit Blueberry", "Purple")
|
|
101
|
+
@fruit_person.field("Fruit Blueberry").should== "Purple"
|
|
102
|
+
@fruit_person.attributes["subject_datas"][2].subject_field_id.should == 1
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "Can still set and read the usual way of reading attrivutes" do
|
|
106
|
+
@fruit_person.first_name = "Jacob"
|
|
107
|
+
@fruit_person.first_name.should== "Jacob"
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
end
|
|
45
112
|
|
|
46
113
|
it { subject.label.should == 'Party' }
|
|
47
114
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Highrise::SubjectData do
|
|
4
|
+
it { should be_a_kind_of Highrise::Base }
|
|
5
|
+
|
|
6
|
+
it "Two different subject datas with different values are not equal" do
|
|
7
|
+
martini = Highrise::SubjectData.new({:id => 1, :value => "Martini", :subject_field_id => 3, :subject_field_label => "Cocktail"})
|
|
8
|
+
sling = Highrise::SubjectData.new({:id => 2, :value => "Singapore Sling", :subject_field_id => 4, :subject_field_label => "Cocktail"})
|
|
9
|
+
martini.should_not==sling
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "Two different subject datas with different labels are not equal" do
|
|
13
|
+
martini = Highrise::SubjectData.new({:id => 1, :value => "Martini", :subject_field_id => 3, :subject_field_label => "Cocktail"})
|
|
14
|
+
sling = Highrise::SubjectData.new({:id => 2, :value => "Martini", :subject_field_id => 4, :subject_field_label => "Vermouth Brands"})
|
|
15
|
+
martini.should_not==sling
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "Two the same subject datas are equal" do
|
|
19
|
+
martini = Highrise::SubjectData.new({:id => 1, :value => "Martini", :subject_field_id => 3, :subject_field_label => "Cocktail"})
|
|
20
|
+
another_martini = Highrise::SubjectData.new({:id => 2, :value => "Martini", :subject_field_id => 4, :subject_field_label => "Cocktail"})
|
|
21
|
+
martini.should==another_martini
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Highrise::SubjectField do
|
|
4
|
+
it { should be_a_kind_of Highrise::Base }
|
|
5
|
+
let(:two_subject_fields){ [
|
|
6
|
+
Highrise::SubjectField.new({:id => 1, :label => "Cabbage"}),
|
|
7
|
+
Highrise::SubjectField.new({:id => 2, :label => "Chicken"})]
|
|
8
|
+
}
|
|
9
|
+
let(:four_subject_fields){ [
|
|
10
|
+
two_subject_fields,
|
|
11
|
+
Highrise::SubjectField.new({:id => 3, :label => "Pasta"}),
|
|
12
|
+
Highrise::SubjectField.new({:id => 4, :label => "Beans"})].flatten
|
|
13
|
+
}
|
|
14
|
+
let(:subject_field_request){ ActiveResource::Request.new(:get, '/subject_fields.xml', nil, {"Authorization"=>"Bearer OAUTH_TOKEN", "Accept"=>"application/xml"}) }
|
|
15
|
+
let(:two_subject_fields_request_pair){ {subject_field_request => ActiveResource::Response.new(two_subject_fields.to_xml, 200, {})} }
|
|
16
|
+
let(:four_subject_fields_request_pair){ { subject_field_request => ActiveResource::Response.new(four_subject_fields.to_xml, 200, {})} }
|
|
17
|
+
|
|
18
|
+
context 'cache disabled (default)' do
|
|
19
|
+
it "does not use cache for queries" do
|
|
20
|
+
ActiveResource::HttpMock.respond_to(two_subject_fields_request_pair)
|
|
21
|
+
Highrise::SubjectField.find(:all)
|
|
22
|
+
ActiveResource::HttpMock.respond_to(four_subject_fields_request_pair)
|
|
23
|
+
Highrise::SubjectField.find(:all).size.should== 4
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context 'cache enabled (opt-in)' do
|
|
28
|
+
before(:each) do
|
|
29
|
+
Highrise::SubjectField.use_cache(true)
|
|
30
|
+
end
|
|
31
|
+
it "caches 'find all' to prevent too much queries for the SubjectFields" do
|
|
32
|
+
ActiveResource::HttpMock.respond_to(two_subject_fields_request_pair)
|
|
33
|
+
Highrise::SubjectField.find(:all)
|
|
34
|
+
ActiveResource::HttpMock.reset!
|
|
35
|
+
Highrise::SubjectField.find(:all).size.should== 2
|
|
36
|
+
end
|
|
37
|
+
it "invalidates cache" do
|
|
38
|
+
ActiveResource::HttpMock.respond_to(two_subject_fields_request_pair)
|
|
39
|
+
Highrise::SubjectField.find(:all)
|
|
40
|
+
Highrise::SubjectField.invalidate_cache
|
|
41
|
+
ActiveResource::HttpMock.respond_to(four_subject_fields_request_pair)
|
|
42
|
+
Highrise::SubjectField.find(:all).size.should== 4
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: highrise
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1
|
|
4
|
+
version: 3.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcos Tapajós
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activeresource
|
|
@@ -65,6 +65,7 @@ extensions: []
|
|
|
65
65
|
extra_rdoc_files: []
|
|
66
66
|
files:
|
|
67
67
|
- .gitignore
|
|
68
|
+
- .ruby-version
|
|
68
69
|
- .travis.yml
|
|
69
70
|
- Gemfile
|
|
70
71
|
- Gemfile.lock
|
|
@@ -96,6 +97,8 @@ files:
|
|
|
96
97
|
- lib/highrise/recording.rb
|
|
97
98
|
- lib/highrise/searchable.rb
|
|
98
99
|
- lib/highrise/subject.rb
|
|
100
|
+
- lib/highrise/subject_data.rb
|
|
101
|
+
- lib/highrise/subject_field.rb
|
|
99
102
|
- lib/highrise/tag.rb
|
|
100
103
|
- lib/highrise/taggable.rb
|
|
101
104
|
- lib/highrise/task.rb
|
|
@@ -120,6 +123,8 @@ files:
|
|
|
120
123
|
- spec/highrise/recording_spec.rb
|
|
121
124
|
- spec/highrise/searchable_behavior.rb
|
|
122
125
|
- spec/highrise/searchable_spec.rb
|
|
126
|
+
- spec/highrise/subject_data_spec.rb
|
|
127
|
+
- spec/highrise/subject_field_spec.rb
|
|
123
128
|
- spec/highrise/subject_spec.rb
|
|
124
129
|
- spec/highrise/tag_spec.rb
|
|
125
130
|
- spec/highrise/taggable_behavior.rb
|
|
@@ -128,7 +133,7 @@ files:
|
|
|
128
133
|
- spec/highrise/task_spec.rb
|
|
129
134
|
- spec/highrise/user_spec.rb
|
|
130
135
|
- spec/spec_helper.rb
|
|
131
|
-
homepage: http://github.com/
|
|
136
|
+
homepage: http://github.com/tapajos/highrise
|
|
132
137
|
licenses: []
|
|
133
138
|
metadata: {}
|
|
134
139
|
post_install_message:
|
|
@@ -173,6 +178,8 @@ test_files:
|
|
|
173
178
|
- spec/highrise/recording_spec.rb
|
|
174
179
|
- spec/highrise/searchable_behavior.rb
|
|
175
180
|
- spec/highrise/searchable_spec.rb
|
|
181
|
+
- spec/highrise/subject_data_spec.rb
|
|
182
|
+
- spec/highrise/subject_field_spec.rb
|
|
176
183
|
- spec/highrise/subject_spec.rb
|
|
177
184
|
- spec/highrise/tag_spec.rb
|
|
178
185
|
- spec/highrise/taggable_behavior.rb
|