moodstocks 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +10 -2
- data/Gemfile.lock +18 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +53 -1
- data/lib/moodstocks.rb +1 -3
- data/test/helper.rb +17 -0
- data/test/images/sandwich.jpg +0 -0
- data/test/test_moodstocks.rb +7 -0
- data/test/test_moodstocks_client.rb +14 -0
- metadata +55 -13
- data/.gitignore +0 -4
- data/lib/moodstocks/client.rb +0 -28
- data/lib/moodstocks/version.rb +0 -3
- data/moodstocks.gemspec +0 -24
data/.document
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
2
5
|
|
3
|
-
#
|
4
|
-
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.6.4"
|
11
|
+
gem "rcov", ">= 0"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.6.4)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.9.2.2)
|
10
|
+
rcov (0.9.10)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bundler (~> 1.0.0)
|
17
|
+
jeweler (~> 1.6.4)
|
18
|
+
rcov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Alan deLevie
|
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.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= moodstocks
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to moodstocks
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Alan deLevie. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
CHANGED
@@ -1 +1,53 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "moodstocks"
|
18
|
+
gem.homepage = "http://github.com/adelevie/moodstocks"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Ruby wrapper for the Moodstocks image search API}
|
21
|
+
gem.description = %Q{Ruby wrapper for the Moodstocks image search API}
|
22
|
+
gem.email = "adelevie@gmail.com"
|
23
|
+
gem.authors = ["Alan deLevie"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "moodstocks #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/lib/moodstocks.rb
CHANGED
data/test/helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
require 'moodstocks'
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
end
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "erb"
|
3
|
+
|
4
|
+
class TestMoodstocksClient < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@settings = YAML.load(ERB.new(File.new("test/config.yml").read).result)
|
7
|
+
@client = Moodstocks::Client.new(@settings["key"], @settings["secret"])
|
8
|
+
@id = rand(99999)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_create
|
12
|
+
@client.create(@settings["image_1_path"], @id)
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moodstocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,63 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
dependencies:
|
12
|
+
date: 2011-12-10 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &78801520 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *78801520
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
requirement: &78800570 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.6.4
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *78800570
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rcov
|
38
|
+
requirement: &78799960 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *78799960
|
14
47
|
description: Ruby wrapper for the Moodstocks image search API
|
15
|
-
email:
|
16
|
-
- adelevie@gmail.com
|
48
|
+
email: adelevie@gmail.com
|
17
49
|
executables: []
|
18
50
|
extensions: []
|
19
|
-
extra_rdoc_files:
|
51
|
+
extra_rdoc_files:
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.rdoc
|
20
54
|
files:
|
21
|
-
- .
|
55
|
+
- .document
|
22
56
|
- Gemfile
|
57
|
+
- Gemfile.lock
|
58
|
+
- LICENSE.txt
|
59
|
+
- README.rdoc
|
23
60
|
- Rakefile
|
24
61
|
- lib/moodstocks.rb
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
|
29
|
-
|
62
|
+
- test/helper.rb
|
63
|
+
- test/images/sandwich.jpg
|
64
|
+
- test/test_moodstocks.rb
|
65
|
+
- test/test_moodstocks_client.rb
|
66
|
+
homepage: http://github.com/adelevie/moodstocks
|
67
|
+
licenses:
|
68
|
+
- MIT
|
30
69
|
post_install_message:
|
31
70
|
rdoc_options: []
|
32
71
|
require_paths:
|
@@ -37,6 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
37
76
|
- - ! '>='
|
38
77
|
- !ruby/object:Gem::Version
|
39
78
|
version: '0'
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
hash: 137575535
|
40
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
83
|
none: false
|
42
84
|
requirements:
|
@@ -44,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
86
|
- !ruby/object:Gem::Version
|
45
87
|
version: '0'
|
46
88
|
requirements: []
|
47
|
-
rubyforge_project:
|
89
|
+
rubyforge_project:
|
48
90
|
rubygems_version: 1.8.10
|
49
91
|
signing_key:
|
50
92
|
specification_version: 3
|
data/.gitignore
DELETED
data/lib/moodstocks/client.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Moodstocks
|
2
|
-
class Client
|
3
|
-
|
4
|
-
def initialize(key, secret, version="v2")
|
5
|
-
@key = key
|
6
|
-
@secret = secret
|
7
|
-
@version = version
|
8
|
-
@endpoint = "api.moodstocks.com/#{version}"
|
9
|
-
end
|
10
|
-
|
11
|
-
def create(path, id)
|
12
|
-
system("curl --digest -u #{@key}:#{@secret} '#{@endpoint}/ref/#{id}' --form image_file=@'#{path}' -X PUT")
|
13
|
-
end
|
14
|
-
|
15
|
-
def retrieve(path)
|
16
|
-
system("curl --digest -u #{@key}:#{@secret} '#{@endpoint}/search' --form image_file=@'#{path}'")
|
17
|
-
end
|
18
|
-
|
19
|
-
def update(path, id)
|
20
|
-
system("curl --digest -u #{@key}:#{@secret} '#{@endpoint}/ref/#{id}' --form image_file=@'#{path}' -X PUT")
|
21
|
-
end
|
22
|
-
|
23
|
-
def delete(id)
|
24
|
-
system("curl --digest -u #{@key}:#{@secret} '#{@endpoint}/ref/#{id}' -X DELETE")
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
data/lib/moodstocks/version.rb
DELETED
data/moodstocks.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "moodstocks/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "moodstocks"
|
7
|
-
s.version = Moodstocks::VERSION
|
8
|
-
s.authors = ["Alan deLevie"]
|
9
|
-
s.email = ["adelevie@gmail.com"]
|
10
|
-
s.homepage = ""
|
11
|
-
s.summary = %q{Ruby wrapper for the Moodstocks image search API}
|
12
|
-
s.description = %q{Ruby wrapper for the Moodstocks image search API}
|
13
|
-
|
14
|
-
s.rubyforge_project = "moodstocks"
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
# specify any dependencies here; for example:
|
22
|
-
# s.add_development_dependency "rspec"
|
23
|
-
# s.add_runtime_dependency "rest-client"
|
24
|
-
end
|