ruby-satisfaction 0.3.0 → 0.4.0

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/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ tmp/*
2
+ log/*
3
+ pkg
data/CONTRIBUTORS.txt ADDED
@@ -0,0 +1,7 @@
1
+ John Duff
2
+ Pius Uzamere
3
+
4
+ Awards
5
+ ======
6
+
7
+ John Duff gets the "Getting the ball rolling" achievement award for being the first contributor besides myself.
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Scott Fleckenstein
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.
data/README.txt ADDED
@@ -0,0 +1 @@
1
+ README
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "ruby-satisfaction"
5
+ gemspec.summary = "Ruby interface to Get Satisfaction"
6
+ gemspec.description = "Ruby interface to Get Satisfaction"
7
+ gemspec.email = "scott@getsatisfaction.com"
8
+ gemspec.homepage = "http://github.com/nullstyle/ruby-satisfaction"
9
+ gemspec.authors = ["Scott Fleckenstein", "Josh Nichols", "Pius Uzamere"]
10
+ gemspec.rubyforge_project = "satisfaction"
11
+ gemspec.add_dependency('memcache-client', '>= 1.5.0')
12
+ gemspec.add_dependency('oauth', '>= 0.3.5')
13
+ gemspec.add_dependency('activesupport', '>= 2.3.2')
14
+ end
15
+
16
+ Jeweler::RubyforgeTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
19
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 4
3
+ :patch: 0
4
+ :major: 0
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'satisfaction'
data/lib/satisfaction.rb CHANGED
@@ -111,7 +111,9 @@ class Satisfaction
111
111
 
112
112
  def url(path, query_string={})
113
113
  qs = query_string.map{|kv| URI.escape(kv.first.to_s) + "=" + URI.escape(kv.last.to_s)}.join("&")
114
- URI.parse("#{@options[:root]}#{path}?#{qs}")
114
+ uri_string = "#{@options[:root]}#{path}"
115
+ uri_string += "?#{qs}" unless qs.blank?
116
+ URI.parse(uri_string)
115
117
  end
116
118
 
117
119
  def get(path, query_string={})
@@ -39,7 +39,7 @@ class Sfn::Resource < Sfn::HasSatisfaction
39
39
  end
40
40
 
41
41
  def put(attrs)
42
- params = requestify(attrs, self.class.name.underscore)
42
+ params = requestify(attrs, self.class.name.demodulize.underscore)
43
43
  result = satisfaction.put("#{path}.json", params)
44
44
 
45
45
  if result.first == :ok
@@ -88,7 +88,7 @@ class Sfn::ResourceCollection < Sfn::HasSatisfaction
88
88
  end
89
89
 
90
90
  def post(attrs)
91
- params = requestify(attrs, klass.name.underscore)
91
+ params = requestify(attrs, klass.name.demodulize.underscore)
92
92
  result = satisfaction.post("#{path}.json", params)
93
93
 
94
94
  if result.first == :ok
@@ -0,0 +1,75 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{ruby-satisfaction}
5
+ s.version = "0.4.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Scott Fleckenstein", "Josh Nichols", "Pius Uzamere"]
9
+ s.date = %q{2009-07-10}
10
+ s.description = %q{Ruby interface to Get Satisfaction}
11
+ s.email = %q{scott@getsatisfaction.com}
12
+ s.extra_rdoc_files = [
13
+ "README.txt"
14
+ ]
15
+ s.files = [
16
+ ".gitignore",
17
+ "CONTRIBUTORS.txt",
18
+ "License.txt",
19
+ "README.txt",
20
+ "Rakefile",
21
+ "VERSION.yml",
22
+ "init.rb",
23
+ "lib/satisfaction.rb",
24
+ "lib/satisfaction/associations.rb",
25
+ "lib/satisfaction/cache/hash.rb",
26
+ "lib/satisfaction/cache/memcache.rb",
27
+ "lib/satisfaction/company.rb",
28
+ "lib/satisfaction/external_dependencies.rb",
29
+ "lib/satisfaction/has_satisfaction.rb",
30
+ "lib/satisfaction/identity_map.rb",
31
+ "lib/satisfaction/loader.rb",
32
+ "lib/satisfaction/person.rb",
33
+ "lib/satisfaction/product.rb",
34
+ "lib/satisfaction/reply.rb",
35
+ "lib/satisfaction/resource.rb",
36
+ "lib/satisfaction/resource/attributes.rb",
37
+ "lib/satisfaction/tag.rb",
38
+ "lib/satisfaction/topic.rb",
39
+ "lib/satisfaction/util.rb",
40
+ "ruby-satisfaction.gemspec",
41
+ "spec/company_spec.rb",
42
+ "spec/identity_map_spec.rb",
43
+ "spec/spec_helper.rb"
44
+ ]
45
+ s.homepage = %q{http://github.com/nullstyle/ruby-satisfaction}
46
+ s.rdoc_options = ["--charset=UTF-8"]
47
+ s.require_paths = ["lib"]
48
+ s.rubyforge_project = %q{satisfaction}
49
+ s.rubygems_version = %q{1.3.4}
50
+ s.summary = %q{Ruby interface to Get Satisfaction}
51
+ s.test_files = [
52
+ "spec/company_spec.rb",
53
+ "spec/identity_map_spec.rb",
54
+ "spec/spec_helper.rb"
55
+ ]
56
+
57
+ if s.respond_to? :specification_version then
58
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
+ s.specification_version = 3
60
+
61
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
+ s.add_runtime_dependency(%q<memcache-client>, [">= 1.5.0"])
63
+ s.add_runtime_dependency(%q<oauth>, [">= 0.3.5"])
64
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
65
+ else
66
+ s.add_dependency(%q<memcache-client>, [">= 1.5.0"])
67
+ s.add_dependency(%q<oauth>, [">= 0.3.5"])
68
+ s.add_dependency(%q<activesupport>, [">= 2.3.2"])
69
+ end
70
+ else
71
+ s.add_dependency(%q<memcache-client>, [">= 1.5.0"])
72
+ s.add_dependency(%q<oauth>, [">= 0.3.5"])
73
+ s.add_dependency(%q<activesupport>, [">= 2.3.2"])
74
+ end
75
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Company loader" do
4
+ it "should work" do
5
+ @satisfaction.set_consumer('lmwjv4kzwi27', 'fiei6iv61jnoukaq1aylwd8vcmnkafrs')
6
+ p @satisfaction.request_token
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "Identity Map" do
4
+ it "should work single instances" do
5
+ c1 = @satisfaction.companies.get(4)
6
+ c2 = @satisfaction.companies.get(4)
7
+
8
+ c1.object_id.should == c2.object_id
9
+ end
10
+
11
+ it "should load one if the other gets loaded" do
12
+ c1 = @satisfaction.companies.get(4)
13
+ c2 = @satisfaction.companies.get(4)
14
+ c2.should_not be_loaded
15
+
16
+ c1.load
17
+
18
+ c2.should be_loaded
19
+ c2.domain.should == 'satisfaction'
20
+ end
21
+
22
+ it "should work with pages too" do
23
+ c1 = @satisfaction.companies.get(4)
24
+ c2 = @satisfaction.companies.page(1, :q => 'satisfaction').first
25
+
26
+ c1.object_id.should == c2.object_id
27
+ end
28
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ $:.unshift "#{File.dirname(__FILE__)}/../lib"
4
+
5
+ require 'satisfaction'
6
+
7
+ Spec::Runner.configure do |config|
8
+ config.prepend_before(:each){ @satisfaction = Satisfaction.new(:root => 'http://api.getsatisfaction.com') }
9
+ end
metadata CHANGED
@@ -1,26 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-satisfaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Fleckenstein
8
+ - Josh Nichols
9
+ - Pius Uzamere
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
13
 
12
- date: 2009-07-06 00:00:00 -07:00
14
+ date: 2009-07-10 00:00:00 -07:00
13
15
  default_executable:
14
16
  dependencies:
15
17
  - !ruby/object:Gem::Dependency
16
- name: rspec
18
+ name: memcache-client
17
19
  type: :runtime
18
20
  version_requirement:
19
21
  version_requirements: !ruby/object:Gem::Requirement
20
22
  requirements:
21
23
  - - ">="
22
24
  - !ruby/object:Gem::Version
23
- version: "0"
25
+ version: 1.5.0
24
26
  version:
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: oauth
@@ -30,17 +32,7 @@ dependencies:
30
32
  requirements:
31
33
  - - ">="
32
34
  - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: memcache-client
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: "0"
35
+ version: 0.3.5
44
36
  version:
45
37
  - !ruby/object:Gem::Dependency
46
38
  name: activesupport
@@ -50,17 +42,25 @@ dependencies:
50
42
  requirements:
51
43
  - - ">="
52
44
  - !ruby/object:Gem::Version
53
- version: "0"
45
+ version: 2.3.2
54
46
  version:
55
- description:
56
- email: nullstyle@gmail.com
47
+ description: Ruby interface to Get Satisfaction
48
+ email: scott@getsatisfaction.com
57
49
  executables: []
58
50
 
59
51
  extensions: []
60
52
 
61
- extra_rdoc_files: []
62
-
53
+ extra_rdoc_files:
54
+ - README.txt
63
55
  files:
56
+ - .gitignore
57
+ - CONTRIBUTORS.txt
58
+ - License.txt
59
+ - README.txt
60
+ - Rakefile
61
+ - VERSION.yml
62
+ - init.rb
63
+ - lib/satisfaction.rb
64
64
  - lib/satisfaction/associations.rb
65
65
  - lib/satisfaction/cache/hash.rb
66
66
  - lib/satisfaction/cache/memcache.rb
@@ -72,20 +72,22 @@ files:
72
72
  - lib/satisfaction/person.rb
73
73
  - lib/satisfaction/product.rb
74
74
  - lib/satisfaction/reply.rb
75
- - lib/satisfaction/resource/attributes.rb
76
75
  - lib/satisfaction/resource.rb
76
+ - lib/satisfaction/resource/attributes.rb
77
77
  - lib/satisfaction/tag.rb
78
78
  - lib/satisfaction/topic.rb
79
79
  - lib/satisfaction/util.rb
80
- - lib/satisfaction/version.rb
81
- - lib/satisfaction.rb
80
+ - ruby-satisfaction.gemspec
81
+ - spec/company_spec.rb
82
+ - spec/identity_map_spec.rb
83
+ - spec/spec_helper.rb
82
84
  has_rdoc: true
83
- homepage: http://nullstyle.com
85
+ homepage: http://github.com/nullstyle/ruby-satisfaction
84
86
  licenses: []
85
87
 
86
88
  post_install_message:
87
- rdoc_options: []
88
-
89
+ rdoc_options:
90
+ - --charset=UTF-8
89
91
  require_paths:
90
92
  - lib
91
93
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -102,10 +104,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
104
  version:
103
105
  requirements: []
104
106
 
105
- rubyforge_project:
107
+ rubyforge_project: satisfaction
106
108
  rubygems_version: 1.3.4
107
109
  signing_key:
108
110
  specification_version: 3
109
- summary: Helper gem for the getsatisfaction.com API
110
- test_files: []
111
-
111
+ summary: Ruby interface to Get Satisfaction
112
+ test_files:
113
+ - spec/company_spec.rb
114
+ - spec/identity_map_spec.rb
115
+ - spec/spec_helper.rb
@@ -1,9 +0,0 @@
1
- class Satisfaction #:nodoc:
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 0
5
- TINY = 1
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
- end
9
- end