bueda 0.1.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 @@
1
+ *.gem
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Bueda Inc.
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 NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,21 @@
1
+ = Bueda API RubyGem
2
+
3
+ * Project Website - http://bueda.com
4
+
5
+ == Description
6
+ The Bueda API RubyGem provides a lightweight wrapper around the Bueda API,
7
+ allowing you to quickly use the service in your Ruby applications.
8
+
9
+ This library requires an API key from http://bueda.com.
10
+
11
+ == External Dependencies
12
+ * Ruby 1.8 (tested with 1.8.7)
13
+ * RSpec gem 1.0.0+ (tested with 1.3)
14
+ * HTTParty 0.5.2+ (tested with 0.5.2)
15
+
16
+ == Usage Examples
17
+
18
+ require 'bueda'
19
+ c = Bueda::Client.new("JGQYtV6tbFHGOL6BSwYcZyHMO9MMZUC9Ev1Ihg")
20
+ tags = ["porsche", "car", "sports", "awesome"]
21
+ pp c.enriched(tags)
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gem|
6
+ gem.name = "bueda"
7
+ gem.summary = %Q{Provides a lightweight Ruby wrapper for the Bueda API.}
8
+ gem.description = %Q{Provides a lightweight Ruby wrapper for the Bueda API.}
9
+ gem.email = "peplin@bueda.com"
10
+ gem.homepage = "http://github.com/peplin/bueda-ruby"
11
+ gem.authors = ["Christopher Peplin"]
12
+ gem.add_dependency 'httparty', '0.5.2'
13
+ gem.add_development_dependency "rspec", "1.3"
14
+ gem.post_install_message = "Make sure to register for an API key at http://bueda.com"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
21
+
22
+ require 'spec/rake/spectask'
23
+ Spec::Rake::SpecTask.new(:spec) do |spec|
24
+ spec.libs << 'lib' << 'spec'
25
+ spec.spec_files = FileList['spec/**/*_spec.rb']
26
+ spec.spec_opts = ['--options', 'spec/spec.opts']
27
+ end
28
+
29
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
30
+ spec.libs << 'lib' << 'spec'
31
+ spec.pattern = 'spec/**/*_spec.rb'
32
+ spec.rcov = true
33
+ end
34
+
35
+ task :spec => :check_dependencies
36
+ task :default => [:spec]
37
+
38
+ require 'rake/rdoctask'
39
+ Rake::RDocTask.new do |rdoc|
40
+ if File.exist?('VERSION')
41
+ version = File.read('VERSION')
42
+ else
43
+ version = ""
44
+ end
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "bueda-ruby #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ rdoc.rdoc_files.include('lib/bueda.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bueda.gemspec ADDED
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{bueda}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Christopher Peplin"]
12
+ s.date = %q{2010-04-22}
13
+ s.description = %q{Provides a lightweight Ruby wrapper for the Bueda API.}
14
+ s.email = %q{peplin@bueda.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "bueda.gemspec",
26
+ "lib/bueda.rb",
27
+ "lib/bueda/client.rb",
28
+ "spec/bueda/client_spec.rb",
29
+ "spec/spec.opts",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/peplin/bueda-ruby}
33
+ s.post_install_message = %q{Make sure to register for an API key at http://bueda.com}
34
+ s.rdoc_options = ["--charset=UTF-8"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.3.5}
37
+ s.summary = %q{Provides a lightweight Ruby wrapper for the Bueda API.}
38
+ s.test_files = [
39
+ "spec/spec_helper.rb",
40
+ "spec/bueda/client_spec.rb"
41
+ ]
42
+
43
+ if s.respond_to? :specification_version then
44
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<httparty>, ["= 0.5.2"])
49
+ s.add_development_dependency(%q<rspec>, ["= 1.3"])
50
+ else
51
+ s.add_dependency(%q<httparty>, ["= 0.5.2"])
52
+ s.add_dependency(%q<rspec>, ["= 1.3"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<httparty>, ["= 0.5.2"])
56
+ s.add_dependency(%q<rspec>, ["= 1.3"])
57
+ end
58
+ end
59
+
data/lib/bueda.rb ADDED
@@ -0,0 +1,12 @@
1
+ module Bueda
2
+ VERSION = "0.1".freeze
3
+ end
4
+
5
+ def require_local(suffix)
6
+ require(File.expand_path(File.join(File.dirname(__FILE__), suffix)))
7
+ end
8
+
9
+ # External requires
10
+ require('httparty')
11
+
12
+ require_local('bueda/client')
@@ -0,0 +1,37 @@
1
+ require 'httparty'
2
+
3
+ module Bueda
4
+ class Client
5
+ include HTTParty
6
+ base_uri 'http://api.bueda.com'
7
+ format :json
8
+
9
+ def initialize(apikey)
10
+ self.class.default_params :apikey => apikey
11
+ end
12
+
13
+ def version()
14
+ self.class.get('/version')
15
+ end
16
+
17
+ def enriched(tags, options={})
18
+ options.merge!(:query => {:tags => tags.join(',')})
19
+ self.class.get('/enriched', options)['result']
20
+ end
21
+
22
+ def categories(tags, options={})
23
+ options.merge!(:query => {:tags => tags.join(',')})
24
+ self.class.get('/categories', options)['result']
25
+ end
26
+
27
+ def split(tags, options={})
28
+ options.merge!({:tags => tags})
29
+ self.class.get('/separated', options)['result']
30
+ end
31
+
32
+ def concepts(tags, options={})
33
+ options.merge!({:tags => tags})
34
+ self.class.get('/semantics', options)['result']
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe Bueda::Client do
4
+ before(:each) do
5
+ @client = Bueda::Client.new("JGQYtV6tbFHGOL6BSwYcZyHMO9MMZUC9Ev1Ihg")
6
+ @tags = ["porsche", "car", "sports", "awesome"]
7
+ end
8
+
9
+ describe "#enriched" do
10
+ it "should return a hash" do
11
+ @client.enriched(@tags).should be_instance_of(Hash)
12
+ end
13
+ end
14
+
15
+ describe "#categories" do
16
+ it "should return a hash" do
17
+ @client.categories(@tags).should be_instance_of(Hash)
18
+ end
19
+ end
20
+
21
+ describe "#concepts" do
22
+ it "should return a hash" do
23
+ @client.concepts(@tags).should be_instance_of(Hash)
24
+ end
25
+ end
26
+
27
+ describe "#split" do
28
+ it "should return a hash" do
29
+ @client.split(@tags).should be_instance_of(Hash)
30
+ end
31
+ end
32
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format specdoc
3
+ --backtrace
@@ -0,0 +1 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'bueda')
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bueda
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Peplin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-04-22 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.5.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "="
32
+ - !ruby/object:Gem::Version
33
+ version: "1.3"
34
+ version:
35
+ description: Provides a lightweight Ruby wrapper for the Bueda API.
36
+ email: peplin@bueda.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .gitignore
46
+ - LICENSE
47
+ - README.rdoc
48
+ - Rakefile
49
+ - VERSION
50
+ - bueda.gemspec
51
+ - lib/bueda.rb
52
+ - lib/bueda/client.rb
53
+ - spec/bueda/client_spec.rb
54
+ - spec/spec.opts
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/peplin/bueda-ruby
58
+ licenses: []
59
+
60
+ post_install_message: Make sure to register for an API key at http://bueda.com
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.5
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Provides a lightweight Ruby wrapper for the Bueda API.
84
+ test_files:
85
+ - spec/spec_helper.rb
86
+ - spec/bueda/client_spec.rb