moodstocks 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in moodstocks.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,28 @@
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
@@ -0,0 +1,3 @@
1
+ module Moodstocks
2
+ VERSION = "0.0.1"
3
+ end
data/lib/moodstocks.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "moodstocks/version"
2
+ require "moodstocks/client"
3
+
4
+ module Moodstocks
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,24 @@
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
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moodstocks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alan deLevie
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-23 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Ruby wrapper for the Moodstocks image search API
15
+ email:
16
+ - adelevie@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - Rakefile
24
+ - lib/moodstocks.rb
25
+ - lib/moodstocks/client.rb
26
+ - lib/moodstocks/version.rb
27
+ - moodstocks.gemspec
28
+ homepage: ''
29
+ licenses: []
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project: moodstocks
48
+ rubygems_version: 1.8.10
49
+ signing_key:
50
+ specification_version: 3
51
+ summary: Ruby wrapper for the Moodstocks image search API
52
+ test_files: []