digital-ocean 0.0.1.placeholder → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53b7645233b0d58538dda1f2c03cb1812c000de7
4
- data.tar.gz: 6c8ba0fe9b5c9b65428b9d578a43b7b3f016543d
3
+ metadata.gz: 4c1a28a5f1fc1bddf52167ef0dfd9e558a26f063
4
+ data.tar.gz: 6c0c9f00340eb477953595582a0e582399850c11
5
5
  SHA512:
6
- metadata.gz: fe4e0333cb29fbb76f2bf9957239fd8ab2e48009aa177fe84820245d08956702adfa5e65e731d8fe7767bcee8508e8de34bf62a14ffc69b34112acd01df14215
7
- data.tar.gz: 47c279eee7fd302b90fb1d26e29577e2d811397c43c020a7a2341cda9e410d11f7f9ff7a3baa8f08c56df0e2777632aeb01ecdb039ea1c84cb0af8e3f994628e
6
+ metadata.gz: 8f924fb366e60f57739a6dfeefa9c40364da493d7d592c9da7b6af24f9d276a465b3f92f32d0e45fff82cd69c61e3f1a6d0af6623d7eb7d251b5e403ac158da6
7
+ data.tar.gz: e9cd2736b306ecbdc8072bf64545016940f2d2ecce50c2e2547a736c2e36b649fd050e0c36da6613ce2e0f941d3bf8f8e7e9f29335975ae1a680c7278d9f08c5
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DigitalOcean
1
+ # Digital Ocean API
2
2
 
3
3
  This gem is a simple and easy-to-use wrapper for Digital Ocean's API.
4
4
 
@@ -19,7 +19,7 @@ $ bundle install
19
19
  Or install it yourself as:
20
20
 
21
21
  ```bash
22
- $ gem install digital_ocean
22
+ $ gem install digital-ocean
23
23
  ```
24
24
 
25
25
  ## Contributing
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["caseyscarborough@gmail.com"]
11
11
  spec.description = "A wrapper for Digital Ocean's API."
12
12
  spec.summary = "A simple and easy-to-use wrapper for interacting with Digital Ocean's API."
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/caseyscarborough/digital-ocean"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -20,4 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_dependency "httparty"
24
+ spec.add_dependency "hashie"
25
+ spec.add_dependency "json" if RUBY_VERSION < '1.9.2'
23
26
  end
data/lib/digital_ocean.rb CHANGED
@@ -1,5 +1,23 @@
1
- require "digital_ocean/version"
1
+ require 'json'
2
+ require 'httparty'
3
+ require 'hashie'
4
+ require 'digital_ocean/version'
5
+ require 'digital_ocean/default'
6
+ require 'digital_ocean/client'
2
7
 
3
8
  module DigitalOcean
4
- # Your code goes here...
9
+ class << self
10
+
11
+ def client(options={})
12
+ @client = DigitalOcean::Client.new(options) unless @client
13
+ @client
14
+ end
15
+
16
+ private
17
+
18
+ def method_missing(name, *args, &block)
19
+ DigitalOcean.client.send(name, *args, &block)
20
+ end
21
+
22
+ end
5
23
  end
@@ -0,0 +1,32 @@
1
+ require 'digital_ocean/client/droplets'
2
+
3
+ module DigitalOcean
4
+ class Client
5
+
6
+ include HTTParty
7
+ base_uri Default::API_ENDPOINT
8
+
9
+ include DigitalOcean::Client::Droplets
10
+
11
+ attr_accessor :client_id, :api_key
12
+
13
+ def initialize(options={})
14
+ if options[:client_id] && options[:api_key]
15
+ @client_id = options[:client_id]
16
+ @api_key = options[:api_key]
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def get(url, params={})
23
+ response = self.class.get url, :query => params
24
+ Hashie::Mash.new response.parsed_response
25
+ end
26
+
27
+ def auth_params
28
+ { :client_id => self.client_id, :api_key => self.api_key } if @client_id && @api_key
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ module DigitalOcean
2
+ class Client
3
+
4
+ # Methods for the Droplets API.
5
+ #
6
+ # @see https://www.digitalocean.com/api_access#api
7
+ module Droplets
8
+
9
+ # Show all active droplets
10
+ #
11
+ # This method returns all active droplets that are currently
12
+ # running in your account. All available API information is
13
+ # presented for each droplet.
14
+ #
15
+ # @return [Hashie::Mash] The list of droplets.
16
+ # @example
17
+ # client.droplets
18
+ def droplets
19
+ get "/droplets", auth_params
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ module DigitalOcean
2
+
3
+ # Default Configuration
4
+ module Default
5
+
6
+ # Default API endpoint for Digital Ocean's API.
7
+ API_ENDPOINT = "https://api.digitalocean.com/".freeze
8
+
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module DigitalOcean
2
- VERSION = "0.0.1.placeholder"
2
+ VERSION = "0.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digital-ocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.placeholder
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Scarborough
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-29 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hashie
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: A wrapper for Digital Ocean's API.
42
70
  email:
43
71
  - caseyscarborough@gmail.com
@@ -53,8 +81,11 @@ files:
53
81
  - digital-ocean.gemspec
54
82
  - lib/digital-ocean.rb
55
83
  - lib/digital_ocean.rb
84
+ - lib/digital_ocean/client.rb
85
+ - lib/digital_ocean/client/droplets.rb
86
+ - lib/digital_ocean/default.rb
56
87
  - lib/digital_ocean/version.rb
57
- homepage: ''
88
+ homepage: https://github.com/caseyscarborough/digital-ocean
58
89
  licenses:
59
90
  - MIT
60
91
  metadata: {}
@@ -69,14 +100,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
100
  version: '0'
70
101
  required_rubygems_version: !ruby/object:Gem::Requirement
71
102
  requirements:
72
- - - '>'
103
+ - - '>='
73
104
  - !ruby/object:Gem::Version
74
- version: 1.3.1
105
+ version: '0'
75
106
  requirements: []
76
107
  rubyforge_project:
77
- rubygems_version: 2.0.5
108
+ rubygems_version: 2.0.6
78
109
  signing_key:
79
110
  specification_version: 4
80
111
  summary: A simple and easy-to-use wrapper for interacting with Digital Ocean's API.
81
112
  test_files: []
82
- has_rdoc: