bitballoon 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +68 -0
- data/lib/bitballoon.rb +2 -0
- data/lib/bitballoon/access_token.rb +5 -0
- data/lib/bitballoon/access_tokens.rb +7 -0
- data/lib/bitballoon/client.rb +8 -0
- data/lib/bitballoon/collection_proxy.rb +6 -6
- data/lib/bitballoon/dns_record.rb +5 -0
- data/lib/bitballoon/dns_records.rb +7 -0
- data/lib/bitballoon/dns_zone.rb +5 -0
- data/lib/bitballoon/dns_zones.rb +11 -0
- data/lib/bitballoon/model.rb +4 -3
- data/lib/bitballoon/version.rb +1 -1
- metadata +8 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -80,6 +80,13 @@ Or a zip file:
|
|
80
80
|
bitballoon deploy /path/to/my/site.zip
|
81
81
|
```
|
82
82
|
|
83
|
+
If there is no .bitballoon file yet, you can deploy to an existing site by passing in the ID:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
bitballoon deploy /path/to/my/site.zip --site-id YOUR_SITE_ID
|
87
|
+
```
|
88
|
+
|
89
|
+
|
83
90
|
Sites
|
84
91
|
=====
|
85
92
|
|
@@ -344,3 +351,64 @@ Remove a snippet
|
|
344
351
|
site.snippet.get(id).destroy
|
345
352
|
end
|
346
353
|
```
|
354
|
+
|
355
|
+
DNS Zones
|
356
|
+
=========
|
357
|
+
|
358
|
+
Resellers can manage DNS Zones through the ruby client. To use this feature your access token must belong to a reseller administrator.
|
359
|
+
|
360
|
+
Create a DNS Zone
|
361
|
+
|
362
|
+
```ruby
|
363
|
+
bitballoon.dns_zones.create(:name => "www.example.com", :user_id => "1234")
|
364
|
+
```
|
365
|
+
|
366
|
+
Get all DNS Zones
|
367
|
+
|
368
|
+
```ruby
|
369
|
+
bitballoon.dns_zones.all
|
370
|
+
```
|
371
|
+
|
372
|
+
Delete a DNS Zone
|
373
|
+
|
374
|
+
```ruby
|
375
|
+
dns_zone.destroy
|
376
|
+
```
|
377
|
+
|
378
|
+
Get all dns records for a zone
|
379
|
+
|
380
|
+
```ruby
|
381
|
+
dns_zone.dns_records.all
|
382
|
+
```
|
383
|
+
|
384
|
+
Adding a new record (supported types: A, CNAME, TXT, MX)
|
385
|
+
|
386
|
+
```ruby
|
387
|
+
dns_zone.dns_records.create(:hostname => "www", :type => "CNAME", :value => "bitballoon.com", :ttl => "500")
|
388
|
+
```
|
389
|
+
|
390
|
+
Deleting a record
|
391
|
+
|
392
|
+
```ruby
|
393
|
+
dns_record.destroy
|
394
|
+
```
|
395
|
+
|
396
|
+
Access Tokens
|
397
|
+
=============
|
398
|
+
|
399
|
+
Resellers can create and revoke access tokens on behalf of their users. To use this feature your access token must belong to a reseller administrator.
|
400
|
+
|
401
|
+
Create access token:
|
402
|
+
|
403
|
+
```ruby
|
404
|
+
bitballoon.access_tokens.create(:user => {:email => "test@example.com", :uid => 123})
|
405
|
+
```
|
406
|
+
|
407
|
+
The user must have either an email or a uid or both. Both email and uid must be unique within your reseller account. The uid would typically correspond to your internal database id for the user. If the users doesn't exist, a new user will be created on the fly.
|
408
|
+
|
409
|
+
Revoke access token:
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
bitballoon.access_tokens.get("token-string").destroy
|
413
|
+
```
|
414
|
+
|
data/lib/bitballoon.rb
CHANGED
data/lib/bitballoon/client.rb
CHANGED
@@ -19,8 +19,8 @@ module BitBalloon
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def all(options = {})
|
22
|
-
response = client.request(:get,
|
23
|
-
response.parsed.map {|attributes| model.new(client, attributes) } if response.parsed
|
22
|
+
response = client.request(:get, path, {:params => options})
|
23
|
+
response.parsed.map {|attributes| model.new(client, attributes.merge(:prefix => prefix)) } if response.parsed
|
24
24
|
end
|
25
25
|
|
26
26
|
def each(&block)
|
@@ -29,12 +29,12 @@ module BitBalloon
|
|
29
29
|
|
30
30
|
def get(id)
|
31
31
|
response = client.request(:get, ::File.join(path, id))
|
32
|
-
model.new(client, response.parsed) if response.parsed
|
32
|
+
model.new(client, response.parsed.merge(:prefix => prefix)) if response.parsed
|
33
33
|
end
|
34
34
|
|
35
35
|
def create(attributes)
|
36
|
-
response = client.request(:post, path, attributes)
|
37
|
-
model.new(client, response.parsed) if response.parsed
|
36
|
+
response = client.request(:post, path, :body => attributes)
|
37
|
+
model.new(client, response.parsed.merge(:prefix => prefix)) if response.parsed
|
38
38
|
end
|
39
39
|
|
40
40
|
def model
|
@@ -42,7 +42,7 @@ module BitBalloon
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def path
|
45
|
-
self.class.path
|
45
|
+
[prefix, self.class.path].compact.join("/")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/bitballoon/model.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module BitBalloon
|
2
2
|
class Model
|
3
|
-
attr_reader :client, :attributes
|
3
|
+
attr_reader :client, :attributes, :prefix
|
4
4
|
|
5
5
|
def self.fields(*names)
|
6
6
|
return @fields if names.empty?
|
@@ -27,6 +27,7 @@ module BitBalloon
|
|
27
27
|
def initialize(client, attributes)
|
28
28
|
@client = client
|
29
29
|
@attributes = {}
|
30
|
+
@prefix = attributes.delete(:prefix)
|
30
31
|
process(attributes)
|
31
32
|
end
|
32
33
|
|
@@ -40,7 +41,7 @@ module BitBalloon
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def update(attributes)
|
43
|
-
response = client.request(:put, path, attributes)
|
44
|
+
response = client.request(:put, path, :body => attributes)
|
44
45
|
process(response.parsed) if response.parsed
|
45
46
|
end
|
46
47
|
|
@@ -58,7 +59,7 @@ module BitBalloon
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def path
|
61
|
-
::File.join(collection.path, id)
|
62
|
+
::File.join(*[prefix, collection.path, id.to_s].compact)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
data/lib/bitballoon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitballoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
@@ -107,10 +107,16 @@ files:
|
|
107
107
|
- bin/bitballoon
|
108
108
|
- bitballoon.gemspec
|
109
109
|
- lib/bitballoon.rb
|
110
|
+
- lib/bitballoon/access_token.rb
|
111
|
+
- lib/bitballoon/access_tokens.rb
|
110
112
|
- lib/bitballoon/client.rb
|
111
113
|
- lib/bitballoon/collection_proxy.rb
|
112
114
|
- lib/bitballoon/deploy.rb
|
113
115
|
- lib/bitballoon/deploys.rb
|
116
|
+
- lib/bitballoon/dns_record.rb
|
117
|
+
- lib/bitballoon/dns_records.rb
|
118
|
+
- lib/bitballoon/dns_zone.rb
|
119
|
+
- lib/bitballoon/dns_zones.rb
|
114
120
|
- lib/bitballoon/file.rb
|
115
121
|
- lib/bitballoon/files.rb
|
116
122
|
- lib/bitballoon/form.rb
|