grin 0.9.0 → 0.9.1

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/Rakefile CHANGED
@@ -8,7 +8,5 @@ Rake::TestTask.new(:test) do |test|
8
8
  test.verbose = true
9
9
  end
10
10
 
11
- task :test => :check_dependencies
12
-
13
11
  task :default => :test
14
12
 
data/lib/grin/album.rb CHANGED
@@ -23,5 +23,9 @@ module Grin
23
23
  end
24
24
  end
25
25
 
26
+ def create_photo(image_data)
27
+ post("albums/#{id}/photos.json", { :photo => { :image => image_data } })
28
+ end
29
+
26
30
  end
27
31
  end
data/lib/grin/client.rb CHANGED
@@ -20,11 +20,21 @@ module Grin
20
20
  end
21
21
  end
22
22
 
23
+ def create_album(title, category_id = nil)
24
+ if album = post("albums.json", { :album => { :title => title, :category_id => category_id } })
25
+ return Album.new(album, @auth_string)
26
+ end
27
+ end
28
+
23
29
  private
24
30
 
25
- def get(path, ssl = false)
31
+ def get(path)
26
32
  JSON.parse(RestClient.get("http://#{@auth_string}.fotogger.com/api/#{API_VERSION}/#{path}").body)
27
33
  end
28
34
 
35
+ def post(path, params = {})
36
+ JSON.parse(RestClient.post("http://#{@auth_string}.fotogger.com/api/#{API_VERSION}/#{path}", params).body)
37
+ end
38
+
29
39
  end
30
40
  end
data/lib/test.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'grin'
3
+ require 'smirk'
4
+
5
+ smug = Smirk::Client.new("teamwylie@hotmail.com", "carter")
6
+ smug_album = smug.find_album(id, key)
7
+ smug_album.images(true).each do |image|
8
+ `curl #{image.originalurl} -o #{image.filename}`
9
+ end
10
+
11
+ fotogger = Grin::Client.new("amp", "witty@bensie.com", "littlebuddy")
12
+ #album = fotogger.create_album("Test")
13
+ album = fotogger.album(15)
14
+
15
+ puts album.create_photo(File.open("/Users/jkmiller/Desktop/Rome/Italy 2010-8157.jpg"))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Miller
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-11 00:00:00 -07:00
18
+ date: 2010-07-14 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -66,6 +66,7 @@ files:
66
66
  - lib/grin/client.rb
67
67
  - lib/grin/photo.rb
68
68
  - lib/grin.rb
69
+ - lib/test.rb
69
70
  - test/helper.rb
70
71
  - test/test_grin.rb
71
72
  has_rdoc: true