barge 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +9 -0
- data/lib/barge/client.rb +36 -20
- data/lib/barge/resource.rb +1 -0
- data/lib/barge/resource/account.rb +11 -0
- data/lib/barge/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d173fe8f1191101c00d1a37b54a56716130bc6f3
|
4
|
+
data.tar.gz: 939598300c5580e2834d16f563d133bf25d77f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce3030274ce42a059ead6a7b0271cce80f07edea0dba75e91be6c032792b53451a027c92f086932d4057b9e23a298f30bc12e8a4fa6920a78cd7d146d7dc40f
|
7
|
+
data.tar.gz: 97eb399aab0214b8a603585db5259cce9b1f2fba0d8facaa1d06b31c73762819c8d3628544b1ee6c54e03cc3c6cf69e61d374b394b7c2a5999bc9394f0b735a7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
Unreleased - 0.11.0
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
* [Fix character set issue](https://github.com/boats/barge/commit/07144026bbe3702791dffcbad2675e84fc0b358f)
|
5
|
+
* [Drop support for Ruby 1.9.2](https://github.com/boats/barge/commit/5ce2a854f023f72268677129d51615bb28874dd7)
|
6
|
+
* [Add request_options to Barge::Client](https://github.com/boats/barge/commit/a56396bbf9fd177a7159c3b9d822be685f11295a)
|
7
|
+
* [Add account resource](https://github.com/boats/barge/commit/d1eee34ff52e141539389bac5f0d1914c3cb3c7e)
|
8
|
+
|
1
9
|
2014-08-03 - 0.10.0
|
2
10
|
-------------------
|
3
11
|
|
data/README.md
CHANGED
@@ -135,6 +135,15 @@ barge.image.all(per_page: 5, page: 2).next_page # => 3
|
|
135
135
|
barge.image.all(per_page: 5, page: 2).last_page # => 8
|
136
136
|
```
|
137
137
|
|
138
|
+
Account
|
139
|
+
-------
|
140
|
+
|
141
|
+
### Show account information
|
142
|
+
|
143
|
+
``` ruby
|
144
|
+
barge.account.show
|
145
|
+
```
|
146
|
+
|
138
147
|
Action
|
139
148
|
------
|
140
149
|
|
data/lib/barge/client.rb
CHANGED
@@ -4,14 +4,7 @@ require 'faraday_middleware'
|
|
4
4
|
module Barge
|
5
5
|
class Client
|
6
6
|
attr_accessor :access_token
|
7
|
-
|
8
|
-
attr_reader :action
|
9
|
-
attr_reader :domain
|
10
|
-
attr_reader :droplet
|
11
|
-
attr_reader :image
|
12
|
-
attr_reader :key
|
13
|
-
attr_reader :region
|
14
|
-
attr_reader :size
|
7
|
+
attr_accessor :request_options
|
15
8
|
|
16
9
|
DEFAULT_OPTIONS = {}
|
17
10
|
DIGITAL_OCEAN_URL = 'https://api.digitalocean.com/v2'
|
@@ -19,23 +12,47 @@ module Barge
|
|
19
12
|
|
20
13
|
def initialize(options = DEFAULT_OPTIONS)
|
21
14
|
self.access_token = options.fetch(:access_token, nil)
|
15
|
+
self.request_options =
|
16
|
+
{ open_timeout: TIMEOUTS, timeout: TIMEOUTS }
|
17
|
+
.merge(options.fetch(:request_options, {}))
|
22
18
|
yield(self) if block_given?
|
23
19
|
fail ArgumentError, 'missing access_token' unless access_token
|
24
|
-
initialize_resources
|
25
20
|
end
|
26
21
|
|
27
|
-
|
22
|
+
def account
|
23
|
+
@account ||= Resource::Account.new(faraday)
|
24
|
+
end
|
25
|
+
|
26
|
+
def action
|
27
|
+
@action ||= Resource::Action.new(faraday)
|
28
|
+
end
|
29
|
+
|
30
|
+
def domain
|
31
|
+
@domain ||= Resource::Domain.new(faraday)
|
32
|
+
end
|
33
|
+
|
34
|
+
def droplet
|
35
|
+
@droplet ||= Resource::Droplet.new(faraday)
|
36
|
+
end
|
28
37
|
|
29
|
-
def
|
30
|
-
@
|
31
|
-
@domain = Resource::Domain.new(faraday)
|
32
|
-
@droplet = Resource::Droplet.new(faraday)
|
33
|
-
@image = Resource::Image.new(faraday)
|
34
|
-
@key = Resource::Key.new(faraday)
|
35
|
-
@region = Resource::Region.new(faraday)
|
36
|
-
@size = Resource::Size.new(faraday)
|
38
|
+
def image
|
39
|
+
@image ||= Resource::Image.new(faraday)
|
37
40
|
end
|
38
41
|
|
42
|
+
def key
|
43
|
+
@key ||= Resource::Key.new(faraday)
|
44
|
+
end
|
45
|
+
|
46
|
+
def region
|
47
|
+
@region ||= Resource::Region.new(faraday)
|
48
|
+
end
|
49
|
+
|
50
|
+
def size
|
51
|
+
@size ||= Resource::Size.new(faraday)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
39
56
|
def faraday
|
40
57
|
@faraday ||= Faraday.new faraday_options do |f|
|
41
58
|
f.adapter :net_http
|
@@ -46,8 +63,7 @@ module Barge
|
|
46
63
|
f.response :mashify
|
47
64
|
f.response :json
|
48
65
|
|
49
|
-
f.options.
|
50
|
-
f.options.timeout = TIMEOUTS
|
66
|
+
f.options.merge! request_options
|
51
67
|
end
|
52
68
|
end
|
53
69
|
|
data/lib/barge/resource.rb
CHANGED
data/lib/barge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Ørjan Blom"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.3'
|
55
55
|
description: Ruby library for version 2 of DigitalOcean's API
|
56
56
|
email:
|
57
57
|
- blom@blom.tv
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/barge.rb
|
67
67
|
- lib/barge/client.rb
|
68
68
|
- lib/barge/resource.rb
|
69
|
+
- lib/barge/resource/account.rb
|
69
70
|
- lib/barge/resource/action.rb
|
70
71
|
- lib/barge/resource/base.rb
|
71
72
|
- lib/barge/resource/domain.rb
|
@@ -88,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
89
|
requirements:
|
89
90
|
- - ">="
|
90
91
|
- !ruby/object:Gem::Version
|
91
|
-
version: 1.9.
|
92
|
+
version: 1.9.3
|
92
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
95
|
- - ">="
|