bitballoon 0.0.11 → 0.1.0
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/Gemfile.lock +4 -4
- data/README.md +106 -5
- data/lib/bitballoon.rb +1 -0
- data/lib/bitballoon/client.rb +4 -0
- data/lib/bitballoon/collection_proxy.rb +7 -2
- data/lib/bitballoon/model.rb +9 -0
- data/lib/bitballoon/site.rb +4 -0
- data/lib/bitballoon/sites.rb +6 -5
- data/lib/bitballoon/user.rb +17 -0
- data/lib/bitballoon/users.rb +7 -0
- data/lib/bitballoon/version.rb +1 -1
- metadata +4 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bitballoon (0.0.
|
4
|
+
bitballoon (0.0.11)
|
5
5
|
highline
|
6
6
|
oauth2 (>= 0.9.2)
|
7
7
|
slop
|
@@ -13,12 +13,12 @@ GEM
|
|
13
13
|
crack (0.3.2)
|
14
14
|
faraday (0.8.8)
|
15
15
|
multipart-post (~> 1.2.0)
|
16
|
-
highline (1.6.
|
16
|
+
highline (1.6.20)
|
17
17
|
httpauth (0.2.0)
|
18
18
|
jwt (0.1.8)
|
19
19
|
multi_json (>= 1.5)
|
20
20
|
minitest (5.0.8)
|
21
|
-
multi_json (1.8.
|
21
|
+
multi_json (1.8.2)
|
22
22
|
multi_xml (0.5.5)
|
23
23
|
multipart-post (1.2.0)
|
24
24
|
oauth2 (0.9.2)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
multi_xml (~> 0.5)
|
30
30
|
rack (~> 1.2)
|
31
31
|
rack (1.5.2)
|
32
|
-
slop (3.4.
|
32
|
+
slop (3.4.6)
|
33
33
|
webmock (1.11.0)
|
34
34
|
addressable (>= 2.2.7)
|
35
35
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
@@ -149,7 +149,7 @@ site.wait_for_ready
|
|
149
149
|
Update the name of the site (its subdomain), the custom domain and the notification email for form submissions:
|
150
150
|
|
151
151
|
```ruby
|
152
|
-
site.update(:name => "my-site", :custom_domain => "www.example.com", :notification_email => "me@example.com")
|
152
|
+
site.update(:name => "my-site", :custom_domain => "www.example.com", :notification_email => "me@example.com", :password => "secret-password")
|
153
153
|
```
|
154
154
|
|
155
155
|
Deleting a site:
|
@@ -158,6 +158,74 @@ Deleting a site:
|
|
158
158
|
site.destroy!
|
159
159
|
```
|
160
160
|
|
161
|
+
Deploys
|
162
|
+
=======
|
163
|
+
|
164
|
+
Access all deploys for a site
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
site = bitballoon.sites.get(site_id)
|
168
|
+
site.deploys.all
|
169
|
+
```
|
170
|
+
|
171
|
+
Access a specific deploy
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
site = bitballoon.sites.get(site_id)
|
175
|
+
site.deploys.get(id)
|
176
|
+
```
|
177
|
+
|
178
|
+
Restore a deploy (makes it the current live version of the site)
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
site.deploys.get(id).restore
|
182
|
+
```
|
183
|
+
|
184
|
+
Users
|
185
|
+
=====
|
186
|
+
|
187
|
+
Access all users you have access to
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
bitballoon.users.all
|
191
|
+
```
|
192
|
+
|
193
|
+
Access a specific user
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
bitballoon.users.get(id)
|
197
|
+
```
|
198
|
+
|
199
|
+
Create a user. **Reseller only**. A unique email is required. You can optionally include a unique uid, typically the database ID you use for the user on your end.
|
200
|
+
|
201
|
+
```ruby
|
202
|
+
bitballoon.users.create(:email => "some@email.com", :uid => "12345")
|
203
|
+
```
|
204
|
+
|
205
|
+
Update a user. **Reseller only**.
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
bitballoon.users.get(id).update(:email => "new@email.com", :uid => "12345")
|
209
|
+
```
|
210
|
+
|
211
|
+
Delete a user. **Reseller only**
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
bitballoon.users.get(id).destroy
|
215
|
+
```
|
216
|
+
|
217
|
+
Get all sites for a user
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
bitballoon.users.get(id).sites
|
221
|
+
```
|
222
|
+
|
223
|
+
Get all form submissions for a user
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
bitballoon.users.get(id).submissions
|
227
|
+
```
|
228
|
+
|
161
229
|
Forms
|
162
230
|
=====
|
163
231
|
|
@@ -234,12 +302,45 @@ Snippets
|
|
234
302
|
Snippets are small code snippets injected into all HTML pages of a site right before the closing head or body tag. To get all snippets for a site:
|
235
303
|
|
236
304
|
```ruby
|
237
|
-
|
238
|
-
|
305
|
+
site = bitballoon.sites.get(id)
|
306
|
+
site.snippets.all
|
239
307
|
```
|
240
308
|
|
241
309
|
Get a specific snippet
|
242
310
|
|
243
311
|
```ruby
|
244
|
-
|
245
|
-
```
|
312
|
+
site.snippets.get(0)
|
313
|
+
```
|
314
|
+
|
315
|
+
Add a snippet to a site.
|
316
|
+
|
317
|
+
You can specify a `general` snippet that will be inserted into all pages, and a `goal` snippet that will be injected into a page following a successful form submission. Each snippet must have a title. You can optionally set the position of both the general and the goal snippet to `head` or `footer` to determine if it gets injected into the head tag or at the end of the page.
|
318
|
+
|
319
|
+
```ruby
|
320
|
+
site.snippets.create(
|
321
|
+
:general => general_snippet,
|
322
|
+
:general_position => "footer",
|
323
|
+
:goal => goal_snippet,
|
324
|
+
:goal_position => "head",
|
325
|
+
:title => "My Snippet"
|
326
|
+
)
|
327
|
+
```
|
328
|
+
|
329
|
+
Update a snippet
|
330
|
+
|
331
|
+
```ruby
|
332
|
+
site.snippets.get(id).update(
|
333
|
+
:general => general_snippet,
|
334
|
+
:general_position => "footer",
|
335
|
+
:goal => goal_snippet,
|
336
|
+
:goal_position => "head",
|
337
|
+
:title => "My Snippet"
|
338
|
+
)
|
339
|
+
```
|
340
|
+
|
341
|
+
Remove a snippet
|
342
|
+
|
343
|
+
```ruby
|
344
|
+
site.snippet.get(id).destroy
|
345
|
+
end
|
346
|
+
```
|
data/lib/bitballoon.rb
CHANGED
data/lib/bitballoon/client.rb
CHANGED
@@ -18,8 +18,8 @@ module BitBalloon
|
|
18
18
|
self.prefix = prefix
|
19
19
|
end
|
20
20
|
|
21
|
-
def all
|
22
|
-
response = client.request(:get, [prefix, path].compact.join("/"))
|
21
|
+
def all(options = {})
|
22
|
+
response = client.request(:get, [prefix, path].compact.join("/"), {:params => options})
|
23
23
|
response.parsed.map {|attributes| model.new(client, attributes) } if response.parsed
|
24
24
|
end
|
25
25
|
|
@@ -32,6 +32,11 @@ module BitBalloon
|
|
32
32
|
model.new(client, response.parsed) if response.parsed
|
33
33
|
end
|
34
34
|
|
35
|
+
def create(attributes)
|
36
|
+
response = client.request(:post, path, attributes)
|
37
|
+
model.new(client, response.parsed) if response.parsed
|
38
|
+
end
|
39
|
+
|
35
40
|
def model
|
36
41
|
self.class.model
|
37
42
|
end
|
data/lib/bitballoon/model.rb
CHANGED
@@ -39,6 +39,15 @@ module BitBalloon
|
|
39
39
|
self
|
40
40
|
end
|
41
41
|
|
42
|
+
def update(attributes)
|
43
|
+
response = client.request(:put, path, attributes)
|
44
|
+
process(response.parsed) if response.parsed
|
45
|
+
end
|
46
|
+
|
47
|
+
def destroy
|
48
|
+
client.request(:delete, path)
|
49
|
+
end
|
50
|
+
|
42
51
|
def refresh
|
43
52
|
response = client.request(:get, path)
|
44
53
|
process(response.parsed)
|
data/lib/bitballoon/site.rb
CHANGED
data/lib/bitballoon/sites.rb
CHANGED
@@ -10,16 +10,17 @@ module BitBalloon
|
|
10
10
|
path = site_id ? "/sites/#{site_id}" : "/sites"
|
11
11
|
method = site_id ? :put : :post
|
12
12
|
if attributes[:dir]
|
13
|
-
dir = attributes
|
14
|
-
response = client.request(method, path, :body => JSON.generate(
|
13
|
+
dir = attributes.delete(:dir)
|
14
|
+
response = client.request(method, path, :body => JSON.generate(attributes.merge(:files => inventory(dir))), :headers => {"Content-Type" => "application/json"})
|
15
15
|
Site.new(client, response.parsed).tap do |site|
|
16
16
|
site.upload_dir(dir)
|
17
17
|
end
|
18
18
|
elsif attributes[:zip]
|
19
|
-
|
20
|
-
|
19
|
+
zip = attributes.delete(:zip)
|
20
|
+
::File.open(zip) do |file|
|
21
|
+
response = client.request(method, path, :body => attributes.merge(
|
21
22
|
:zip => Faraday::UploadIO.new(file, 'application/zip')
|
22
|
-
|
23
|
+
))
|
23
24
|
Site.new(client, response.parsed)
|
24
25
|
end
|
25
26
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module BitBalloon
|
2
|
+
class User < Model
|
3
|
+
fields :id, :uid, :email, :affiliate_id, :site_count, :created_at, :last_login
|
4
|
+
|
5
|
+
def sites
|
6
|
+
Sites.new(client, path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def submissions
|
10
|
+
Submissions.new(client, path)
|
11
|
+
end
|
12
|
+
|
13
|
+
def forms
|
14
|
+
Forms.new(client, path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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.0
|
4
|
+
version: 0.1.0
|
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-
|
12
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
@@ -123,6 +123,8 @@ files:
|
|
123
123
|
- lib/bitballoon/snippets.rb
|
124
124
|
- lib/bitballoon/submission.rb
|
125
125
|
- lib/bitballoon/submissions.rb
|
126
|
+
- lib/bitballoon/user.rb
|
127
|
+
- lib/bitballoon/users.rb
|
126
128
|
- lib/bitballoon/version.rb
|
127
129
|
- test/client_test.rb
|
128
130
|
- test/files/site-dir.zip
|