ruby-satisfaction 0.6.1 → 0.6.2
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.
- data/Gemfile +2 -1
- data/Gemfile.lock +5 -1
- data/lib/satisfaction/associations.rb +3 -3
- data/lib/satisfaction/version.rb +2 -2
- data/ruby-satisfaction.gemspec +4 -2
- data/spec/satisfaction/associations_spec.rb +58 -0
- metadata +47 -13
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-satisfaction (0.6.
|
4
|
+
ruby-satisfaction (0.6.1)
|
5
5
|
activesupport (~> 2.3)
|
6
6
|
json (>= 1.4.6)
|
7
7
|
memcache-client (>= 1.5.0)
|
@@ -16,6 +16,7 @@ GEM
|
|
16
16
|
configuration (1.2.0)
|
17
17
|
diff-lcs (1.1.2)
|
18
18
|
fakeweb (1.3.0)
|
19
|
+
gemcutter (0.6.1)
|
19
20
|
json (1.4.6)
|
20
21
|
launchy (0.3.7)
|
21
22
|
configuration (>= 0.0.5)
|
@@ -27,6 +28,7 @@ GEM
|
|
27
28
|
open_gem (1.4.2)
|
28
29
|
launchy (~> 0.3.5)
|
29
30
|
rake (0.8.7)
|
31
|
+
rr (1.0.2)
|
30
32
|
rspec (2.2.0)
|
31
33
|
rspec-core (~> 2.2)
|
32
34
|
rspec-expectations (~> 2.2)
|
@@ -48,11 +50,13 @@ DEPENDENCIES
|
|
48
50
|
activesupport (~> 2.3)
|
49
51
|
bundler (>= 1.0.0)
|
50
52
|
fakeweb (~> 1.3)
|
53
|
+
gemcutter (>= 0.6.1)
|
51
54
|
json (>= 1.4.6)
|
52
55
|
memcache-client (>= 1.5.0)
|
53
56
|
nokogiri (>= 1.4.2)
|
54
57
|
oauth (>= 0.3.5)
|
55
58
|
open_gem (>= 1.4)
|
59
|
+
rr (= 1.0.2)
|
56
60
|
rspec (~> 2.2)
|
57
61
|
ruby-debug (>= 0.10.4)
|
58
62
|
ruby-satisfaction!
|
@@ -2,7 +2,7 @@ module Associations
|
|
2
2
|
def has_many(resource, options={})
|
3
3
|
class_name = options[:class_name] || "Sfn::#{resource.to_s.classify}"
|
4
4
|
eval <<-EOS
|
5
|
-
def
|
5
|
+
def self.#{resource}
|
6
6
|
@#{resource} ||= Sfn::ResourceCollection.new(#{class_name}, self.satisfaction, '#{options[:url]}')
|
7
7
|
end
|
8
8
|
EOS
|
@@ -12,9 +12,9 @@ module Associations
|
|
12
12
|
class_name = options[:class_name] || "Sfn::#{resource.to_s.classify}"
|
13
13
|
parent_id = options[:parent_attribute] || "#{resource}_id"
|
14
14
|
eval <<-EOS
|
15
|
-
def
|
15
|
+
def self.#{resource}
|
16
16
|
@#{resource} ||= #{class_name}.new(#{parent_id}, self.satisfaction)
|
17
17
|
end
|
18
18
|
EOS
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
data/lib/satisfaction/version.rb
CHANGED
data/ruby-satisfaction.gemspec
CHANGED
@@ -3,13 +3,13 @@ require File.expand_path("../lib/satisfaction/version", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ruby-satisfaction"
|
6
|
-
s.version =
|
6
|
+
s.version = Satisfaction::VERSION::STRING
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.author = 'Get Satisfaction'
|
9
9
|
s.email = ["nerds+rubygems@getsatisfaction.com"]
|
10
10
|
s.homepage = "https://github.com/satisfaction/ruby-satisfaction"
|
11
11
|
s.summary = "Get Satisfaction ruby client"
|
12
|
-
s.description = "Get Satisfaction is a simple way to build online communities that enable productive conversations between companies and their customers. More than 46,000 companies use Get Satisfaction to provide a more social support experience, build better products, increase SEO and improve customer loyalty. Get Satisfaction communities are available at http://getsatisfaction.com."
|
12
|
+
s.description = "Ruby client for using Get Satisfaction's RESTful API. Get Satisfaction is a simple way to build online communities that enable productive conversations between companies and their customers. More than 46,000 companies use Get Satisfaction to provide a more social support experience, build better products, increase SEO and improve customer loyalty. Get Satisfaction communities are available at http://getsatisfaction.com."
|
13
13
|
|
14
14
|
s.required_rubygems_version = ">= 1.3.6"
|
15
15
|
s.rubyforge_project = "ruby-satisfaction"
|
@@ -21,10 +21,12 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_dependency 'oauth', '>= 0.3.5'
|
22
22
|
|
23
23
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
24
|
+
s.add_development_dependency "gemcutter", ">= 0.6.1"
|
24
25
|
s.add_development_dependency "rspec", "~> 2.2"
|
25
26
|
s.add_development_dependency "fakeweb", "~> 1.3"
|
26
27
|
s.add_development_dependency "open_gem", ">= 1.4"
|
27
28
|
s.add_development_dependency "ruby-debug", ">= 0.10.4"
|
29
|
+
s.add_development_dependency "rr", '1.0.2'
|
28
30
|
|
29
31
|
s.extra_rdoc_files = [ "README.markdown" ]
|
30
32
|
s.files = `git ls-files`.split("\n") - ['.rvmrc', '.gitignore']
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe "Associations" do
|
4
|
+
describe "when included in a class" do
|
5
|
+
attr_reader :klass, :obj
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@klass = Class.new
|
9
|
+
@klass.class_eval do
|
10
|
+
include Associations
|
11
|
+
end
|
12
|
+
@obj = @klass.new
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#has_many" do
|
16
|
+
before(:each) do
|
17
|
+
klass.instance_methods.should_not include("topics")
|
18
|
+
Associations.instance_methods.should_not include("topics")
|
19
|
+
obj.methods.should_not include("topics")
|
20
|
+
obj.has_many :topics, :url => "/path/topics"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should create a method on the object the method is invoked on" do
|
24
|
+
obj.methods.should include("topics")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should not create an instance method on the including class" do
|
28
|
+
klass.instance_methods.should_not include("topics")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should not create an instance method on Associations" do
|
32
|
+
Associations.instance_methods.should_not include("topics")
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#belongs_to" do
|
38
|
+
before(:each) do
|
39
|
+
klass.instance_methods.should_not include("company")
|
40
|
+
Associations.instance_methods.should_not include("company")
|
41
|
+
obj.methods.should_not include("company")
|
42
|
+
obj.belongs_to :company, :url => "/path/company"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should create a method on the object the method is invoked on" do
|
46
|
+
obj.methods.should include("company")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should create an instance method on the including class" do
|
50
|
+
klass.instance_methods.should_not include("company")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should not create an instance method on Associations" do
|
54
|
+
Associations.instance_methods.should_not include("company")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-satisfaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Get Satisfaction
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-14 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -114,9 +114,25 @@ dependencies:
|
|
114
114
|
type: :development
|
115
115
|
version_requirements: *id006
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
|
-
name:
|
117
|
+
name: gemcutter
|
118
118
|
prerelease: false
|
119
119
|
requirement: &id007 !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 5
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
- 6
|
128
|
+
- 1
|
129
|
+
version: 0.6.1
|
130
|
+
type: :development
|
131
|
+
version_requirements: *id007
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: rspec
|
134
|
+
prerelease: false
|
135
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
120
136
|
none: false
|
121
137
|
requirements:
|
122
138
|
- - ~>
|
@@ -127,11 +143,11 @@ dependencies:
|
|
127
143
|
- 2
|
128
144
|
version: "2.2"
|
129
145
|
type: :development
|
130
|
-
version_requirements: *
|
146
|
+
version_requirements: *id008
|
131
147
|
- !ruby/object:Gem::Dependency
|
132
148
|
name: fakeweb
|
133
149
|
prerelease: false
|
134
|
-
requirement: &
|
150
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
135
151
|
none: false
|
136
152
|
requirements:
|
137
153
|
- - ~>
|
@@ -142,11 +158,11 @@ dependencies:
|
|
142
158
|
- 3
|
143
159
|
version: "1.3"
|
144
160
|
type: :development
|
145
|
-
version_requirements: *
|
161
|
+
version_requirements: *id009
|
146
162
|
- !ruby/object:Gem::Dependency
|
147
163
|
name: open_gem
|
148
164
|
prerelease: false
|
149
|
-
requirement: &
|
165
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
150
166
|
none: false
|
151
167
|
requirements:
|
152
168
|
- - ">="
|
@@ -157,11 +173,11 @@ dependencies:
|
|
157
173
|
- 4
|
158
174
|
version: "1.4"
|
159
175
|
type: :development
|
160
|
-
version_requirements: *
|
176
|
+
version_requirements: *id010
|
161
177
|
- !ruby/object:Gem::Dependency
|
162
178
|
name: ruby-debug
|
163
179
|
prerelease: false
|
164
|
-
requirement: &
|
180
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
165
181
|
none: false
|
166
182
|
requirements:
|
167
183
|
- - ">="
|
@@ -173,8 +189,24 @@ dependencies:
|
|
173
189
|
- 4
|
174
190
|
version: 0.10.4
|
175
191
|
type: :development
|
176
|
-
version_requirements: *
|
177
|
-
|
192
|
+
version_requirements: *id011
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: rr
|
195
|
+
prerelease: false
|
196
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
197
|
+
none: false
|
198
|
+
requirements:
|
199
|
+
- - "="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
hash: 19
|
202
|
+
segments:
|
203
|
+
- 1
|
204
|
+
- 0
|
205
|
+
- 2
|
206
|
+
version: 1.0.2
|
207
|
+
type: :development
|
208
|
+
version_requirements: *id012
|
209
|
+
description: Ruby client for using Get Satisfaction's RESTful API. Get Satisfaction is a simple way to build online communities that enable productive conversations between companies and their customers. More than 46,000 companies use Get Satisfaction to provide a more social support experience, build better products, increase SEO and improve customer loyalty. Get Satisfaction communities are available at http://getsatisfaction.com.
|
178
210
|
email:
|
179
211
|
- nerds+rubygems@getsatisfaction.com
|
180
212
|
executables: []
|
@@ -211,6 +243,7 @@ files:
|
|
211
243
|
- lib/satisfaction/util.rb
|
212
244
|
- lib/satisfaction/version.rb
|
213
245
|
- ruby-satisfaction.gemspec
|
246
|
+
- spec/satisfaction/associations_spec.rb
|
214
247
|
- spec/satisfaction/identity_map_spec.rb
|
215
248
|
- spec/satisfaction/loader_spec.rb
|
216
249
|
- spec/satisfaction_spec.rb
|
@@ -252,6 +285,7 @@ signing_key:
|
|
252
285
|
specification_version: 3
|
253
286
|
summary: Get Satisfaction ruby client
|
254
287
|
test_files:
|
288
|
+
- spec/satisfaction/associations_spec.rb
|
255
289
|
- spec/satisfaction/identity_map_spec.rb
|
256
290
|
- spec/satisfaction/loader_spec.rb
|
257
291
|
- spec/satisfaction_spec.rb
|