cloudapp_api 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ gem "httparty", ">= 0.6.0"
4
+ gem "mime-types"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.1.0"
10
+ gem "fakeweb"
11
+ gem "yard", "~> 0.6.0"
12
+ gem "bluecloth"
13
+ gem "cucumber", ">= 0"
14
+ gem "bundler", "~> 1.0.0"
15
+ gem "jeweler", "~> 1.5.1"
16
+ gem "rcov", ">= 0"
17
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ bluecloth (2.0.9)
5
+ builder (3.0.0)
6
+ crack (0.1.8)
7
+ cucumber (0.10.0)
8
+ builder (>= 2.1.2)
9
+ diff-lcs (~> 1.1.2)
10
+ gherkin (~> 2.3.2)
11
+ json (~> 1.4.6)
12
+ term-ansicolor (~> 1.0.5)
13
+ diff-lcs (1.1.2)
14
+ fakeweb (1.3.0)
15
+ gherkin (2.3.2)
16
+ json (~> 1.4.6)
17
+ term-ansicolor (~> 1.0.5)
18
+ git (1.2.5)
19
+ httparty (0.6.1)
20
+ crack (= 0.1.8)
21
+ jeweler (1.5.1)
22
+ bundler (~> 1.0.0)
23
+ git (>= 1.2.5)
24
+ rake
25
+ json (1.4.6)
26
+ mime-types (1.16)
27
+ rake (0.8.7)
28
+ rcov (0.9.9)
29
+ rspec (2.1.0)
30
+ rspec-core (~> 2.1.0)
31
+ rspec-expectations (~> 2.1.0)
32
+ rspec-mocks (~> 2.1.0)
33
+ rspec-core (2.1.0)
34
+ rspec-expectations (2.1.0)
35
+ diff-lcs (~> 1.1.2)
36
+ rspec-mocks (2.1.0)
37
+ term-ansicolor (1.0.5)
38
+ yard (0.6.3)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ bluecloth
45
+ bundler (~> 1.0.0)
46
+ cucumber
47
+ fakeweb
48
+ httparty (>= 0.6.0)
49
+ jeweler (~> 1.5.1)
50
+ mime-types
51
+ rcov
52
+ rspec (~> 2.1.0)
53
+ yard (~> 0.6.0)
data/README.md CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  A simple Ruby wrapper for the [CloudApp API](http://support.getcloudapp.com/faqs/developers/api). Uses [HTTParty](http://github.com/jnunemaker/httparty) with a simple ActiveResource-like interface.
4
4
 
5
- ## TODO
5
+ Two interfaces are provided for interacting with the CloudApp API. The first is a ActiveResource-like interface, directly calling methods on the Item and Account class. The second option is to interact through a Client interface.
6
6
 
7
- * Add tests
8
- * Improve the docs
7
+ * [Familiarise yourself with the documentation](http://rubydoc.info/github/aaronrussell/cloudapp_api/)
9
8
 
10
9
  ## Installation
11
10
 
@@ -13,70 +12,107 @@ To install as a Gem:
13
12
 
14
13
  sudo gem install cloudapp_api
15
14
 
16
- ## Usage
15
+ ## Authentication
17
16
 
18
- ### Authentication
19
-
20
- Authentication isn't necessary if you are just attempting to find an individual item. However, if you are trying to create, delete or list all items, you must authenticate.
17
+ Authentication is necessary for most actions, the only exceptions being when creating a new Account or querying a specific Item.
21
18
 
22
19
  CloudApp.authenticate "email@address.com", "password"
23
20
 
24
- ### Initialize client interface
21
+ ## Item examples
25
22
 
26
- If you are using the client interface, you must create a client instance.
23
+ * Documentation - {CloudApp::Item}
27
24
 
28
- # Optionally you can pass a hash containing :username and :password to authenticate.
29
-
30
- client = CloudApp::Client.new opts
25
+ ---
26
+
27
+ ### Usage via the Item class
28
+ # Find a single item by it's slug
29
+ item = CloudApp::Item.find "2wr4"
30
+
31
+ # Get a list of all items
32
+ items = CloudApp::Item.all
33
+
34
+ # Create a new bookmark
35
+ item = CloudApp::Item.create :bookmark, :name => "CloudApp", :redirect_url => "http://getcloudapp.com"
36
+
37
+ # Upload a file
38
+ item = CloudApp::Item.create :upload, :file => "/path/to/image.png"
39
+
40
+ # Rename a file
41
+ CloudApp::Item.update "http://my.cl.ly/items/1912565", :name => "Big Screenshot"
42
+
43
+ # Set an items privacy
44
+ CloudApp::Item.update "http://my.cl.ly/items/1912565", :private => true
45
+
46
+ # Delete an item
47
+ CloudApp::Item.delete "http://my.cl.ly/items/1912565"
48
+
49
+ ### Usage via an Item instance
50
+ # Rename a file
51
+ @item.update :name => "Big Screenshot"
52
+
53
+ # Set an items privacy
54
+ @item.update :private => true
55
+
56
+ # Delete an item
57
+ @tem.delete
58
+
59
+ ## Usage via a Client instance
60
+
61
+ * Documentation - {CloudApp::Client}
31
62
 
32
- ### View an item by short URL
63
+ ---
33
64
 
34
- short_url = "19xM"
65
+ # Create a Client instance
66
+ @client = CloudApp::Client.new
35
67
 
36
- @item = client.item short_url
68
+ # Find a single item by it's slug
69
+ item = @client.item "2wr4"
37
70
 
38
- # or ..
71
+ # Get a list of all items
72
+ items = @client.all
39
73
 
40
- @item = CloudApp::Item.find short_url
41
-
42
- ### List items
74
+ # Create a new bookmark
75
+ item = @client.bookmark "http://getcloudapp.com", "CloudApp"
43
76
 
44
- # Allowed params
45
- # :page => 1 # page number starting at 1
46
- # :per_page => 5 # number of items per page
47
- # :type => "image" # filter items by type
48
- # (image, bookmark, text, archive, audio, video, or unknown)
49
- # :deleted => true # show trashed items
77
+ # Upload a file
78
+ item = @client.upload "/path/to/image.png"
50
79
 
51
- @items = client.items params
80
+ # Rename a file
81
+ @client.rename "2wr4", "Big Screenshot"
52
82
 
53
- # or ..
83
+ # Set an items privacy
84
+ @client.privacy "2wr4", true
54
85
 
55
- @items = CloudApp::Item.all params
86
+ # Delete an item
87
+ @client.delete "2wr4"
56
88
 
57
- ### Create a bookmark
89
+ ## Account examples
58
90
 
59
- @item = client.bookmark url, name
60
-
61
- # or ..
91
+ * Documentation - {CloudApp::Account}
92
+
93
+ ---
94
+
95
+ # Create a CloudApp account
96
+ @account = CloudApp::Account.create :email => "arthur@dent.com", :password => "towel"
62
97
 
63
- @item = CloudApp::Item.create :bookmark, {:name => name, :redirect_url => url}
98
+ # Forgot password
99
+ CloudApp::Account.reset :email => "arthur@dent.com"
64
100
 
65
- ### Upload a file
66
-
67
- @item = client.upload file_name
101
+ # View details of authenticated account
102
+ @account = CloudApp::Account.find
68
103
 
69
- # or ..
104
+ # Change default security
105
+ @account.update :private_items => false
70
106
 
71
- @item = CloudApp::Item.create :upload, {:file => file_name}
107
+ # Change email
108
+ @account.update :email => "ford@prefect.com", :current_password => "towel"
72
109
 
73
- ### Delete an item
74
-
75
- client.delete short_url
110
+ # Change password
111
+ @account.update :password => "happy frood", :current_password => "towel"
76
112
 
77
- # or ..
113
+ # Set custom domain
114
+ @account.update :domain => "dent.com", :domain_home_page => "http://hhgproject.org"
78
115
 
79
- @item.delete
80
116
 
81
117
  ## Note on Patches/Pull Requests
82
118
 
@@ -90,7 +126,6 @@ If you are using the client interface, you must create a client instance.
90
126
  ## Author & Contributors
91
127
 
92
128
  * [Aaron Russell](http://www.aaronrussell.co.uk)
93
- * [Wade West](http://github.com/wadewest)
94
129
 
95
130
  ## Copyright
96
131
 
data/Rakefile CHANGED
@@ -1,54 +1,47 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
-
2
+ require 'bundler'
4
3
  begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "cloudapp_api"
8
- gem.summary = %Q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
9
- gem.description = %Q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
10
- gem.email = "aaron@gc4.co.uk"
11
- gem.homepage = "http://github.com/aaronrussell/cloud_app"
12
- gem.authors = ["Aaron Russell", "Wade West"]
13
- gem.add_dependency "httparty", ">= 0.5.2"
14
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
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: gem install jeweler"
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
20
9
  end
10
+ require 'rake'
21
11
 
22
- require 'rake/testtask'
23
- Rake::TestTask.new(:test) do |test|
24
- test.libs << 'lib' << 'test'
25
- test.pattern = 'test/**/test_*.rb'
26
- test.verbose = true
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "cloudapp_api"
16
+ gem.homepage = "http://github.com/aaronrussell/cloud_app"
17
+ gem.summary = %Q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
18
+ gem.description = %Q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
19
+ gem.email = "aaron@gc4.co.uk"
20
+ gem.authors = ["Aaron Russell"]
21
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
22
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
23
+ gem.add_runtime_dependency "httparty", ">= 0.6.0"
24
+ gem.add_development_dependency "rspec", "~> 2.1.0"
25
+ gem.add_development_dependency "yard", "~> 0.6.0"
27
26
  end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
28
 
29
- begin
30
- require 'rcov/rcovtask'
31
- Rcov::RcovTask.new do |test|
32
- test.libs << 'test'
33
- test.pattern = 'test/**/test_*.rb'
34
- test.verbose = true
35
- end
36
- rescue LoadError
37
- task :rcov do
38
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
- end
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ spec.verbose
40
34
  end
41
35
 
42
- task :test => :check_dependencies
36
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
37
+ spec.pattern = 'spec/**/*_spec.rb'
38
+ spec.rcov = true
39
+ end
43
40
 
44
- task :default => :test
41
+ require 'cucumber/rake/task'
42
+ Cucumber::Rake::Task.new(:features)
45
43
 
46
- require 'rake/rdoctask'
47
- Rake::RDocTask.new do |rdoc|
48
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+ task :default => :spec
49
45
 
50
- rdoc.rdoc_dir = 'rdoc'
51
- rdoc.title = "cloudapp_api #{version}"
52
- rdoc.rdoc_files.include('README*')
53
- rdoc.rdoc_files.include('lib/**/*.rb')
54
- end
46
+ require 'yard'
47
+ YARD::Rake::YardocTask.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
data/cloudapp_api.gemspec CHANGED
@@ -1,53 +1,64 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cloudapp_api}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Aaron Russell", "Wade West"]
12
- s.date = %q{2010-11-13}
11
+ s.authors = ["Aaron Russell"]
12
+ s.date = %q{2010-12-15}
13
13
  s.description = %q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
14
14
  s.email = %q{aaron@gc4.co.uk}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.md"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "cloudapp_api.gemspec",
27
- "lib/cloudapp/base.rb",
28
- "lib/cloudapp/client.rb",
29
- "lib/cloudapp/httparty.rb",
30
- "lib/cloudapp/monkey_patch/httparty.rb",
31
- "lib/cloudapp/monkey_patch/net_digest_auth.rb",
32
- "lib/cloudapp/multipart.rb",
33
- "lib/cloudapp_api.rb",
34
- "test/helper.rb",
35
- "test/helper/faking_setup.rb",
36
- "test/helper/methods.rb",
37
- "test/test_base.rb",
38
- "test/test_cloudapp_api.rb"
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "cloudapp_api.gemspec",
28
+ "lib/cloudapp/account.rb",
29
+ "lib/cloudapp/base.rb",
30
+ "lib/cloudapp/client.rb",
31
+ "lib/cloudapp/httparty.rb",
32
+ "lib/cloudapp/item.rb",
33
+ "lib/cloudapp/multipart.rb",
34
+ "lib/cloudapp_api.rb",
35
+ "spec/cloudapp_account_spec.rb",
36
+ "spec/cloudapp_api_spec.rb",
37
+ "spec/cloudapp_client_spec.rb",
38
+ "spec/cloudapp_item_spec.rb",
39
+ "spec/fakeweb_helper.rb",
40
+ "spec/spec_helper.rb",
41
+ "spec/stubs/account/create",
42
+ "spec/stubs/account/show",
43
+ "spec/stubs/account/update",
44
+ "spec/stubs/item/create",
45
+ "spec/stubs/item/delete",
46
+ "spec/stubs/item/index",
47
+ "spec/stubs/item/new",
48
+ "spec/stubs/item/show",
49
+ "spec/stubs/item/update"
39
50
  ]
40
51
  s.homepage = %q{http://github.com/aaronrussell/cloud_app}
41
- s.rdoc_options = ["--charset=UTF-8"]
42
52
  s.require_paths = ["lib"]
43
53
  s.rubygems_version = %q{1.3.7}
44
54
  s.summary = %q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
45
55
  s.test_files = [
46
- "test/helper/faking_setup.rb",
47
- "test/helper/methods.rb",
48
- "test/helper.rb",
49
- "test/test_base.rb",
50
- "test/test_cloudapp_api.rb"
56
+ "spec/cloudapp_account_spec.rb",
57
+ "spec/cloudapp_api_spec.rb",
58
+ "spec/cloudapp_client_spec.rb",
59
+ "spec/cloudapp_item_spec.rb",
60
+ "spec/fakeweb_helper.rb",
61
+ "spec/spec_helper.rb"
51
62
  ]
52
63
 
53
64
  if s.respond_to? :specification_version then
@@ -55,15 +66,48 @@ Gem::Specification.new do |s|
55
66
  s.specification_version = 3
56
67
 
57
68
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
58
- s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
59
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
69
+ s.add_runtime_dependency(%q<httparty>, [">= 0.6.0"])
70
+ s.add_runtime_dependency(%q<mime-types>, [">= 0"])
71
+ s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
72
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
73
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
74
+ s.add_development_dependency(%q<bluecloth>, [">= 0"])
75
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
76
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
77
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
78
+ s.add_development_dependency(%q<rcov>, [">= 0"])
79
+ s.add_runtime_dependency(%q<httparty>, [">= 0.6.0"])
80
+ s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
81
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
60
82
  else
61
- s.add_dependency(%q<httparty>, [">= 0.5.2"])
62
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
83
+ s.add_dependency(%q<httparty>, [">= 0.6.0"])
84
+ s.add_dependency(%q<mime-types>, [">= 0"])
85
+ s.add_dependency(%q<rspec>, ["~> 2.1.0"])
86
+ s.add_dependency(%q<fakeweb>, [">= 0"])
87
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
88
+ s.add_dependency(%q<bluecloth>, [">= 0"])
89
+ s.add_dependency(%q<cucumber>, [">= 0"])
90
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
91
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
92
+ s.add_dependency(%q<rcov>, [">= 0"])
93
+ s.add_dependency(%q<httparty>, [">= 0.6.0"])
94
+ s.add_dependency(%q<rspec>, ["~> 2.1.0"])
95
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
63
96
  end
64
97
  else
65
- s.add_dependency(%q<httparty>, [">= 0.5.2"])
66
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
98
+ s.add_dependency(%q<httparty>, [">= 0.6.0"])
99
+ s.add_dependency(%q<mime-types>, [">= 0"])
100
+ s.add_dependency(%q<rspec>, ["~> 2.1.0"])
101
+ s.add_dependency(%q<fakeweb>, [">= 0"])
102
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
103
+ s.add_dependency(%q<bluecloth>, [">= 0"])
104
+ s.add_dependency(%q<cucumber>, [">= 0"])
105
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
106
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
107
+ s.add_dependency(%q<rcov>, [">= 0"])
108
+ s.add_dependency(%q<httparty>, [">= 0.6.0"])
109
+ s.add_dependency(%q<rspec>, ["~> 2.1.0"])
110
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
67
111
  end
68
112
  end
69
113