fjords-client 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Thomas Reynolds
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -60,7 +60,14 @@ module Fjords
60
60
  :logout,
61
61
  :validate_domain,
62
62
  :bugreport,
63
- :info
63
+ :info,
64
+ :site_details,
65
+ :enable_cdn,
66
+ :disable_cdn,
67
+ :has_cdn,
68
+ :has_gzip,
69
+ :enable_gzip,
70
+ :disable_gzip,
64
71
  ].each do |method|
65
72
  module_eval(%Q{
66
73
  def self.#{method}(*args, &block) # def self.login(*args, &block)
@@ -138,6 +145,13 @@ module Fjords
138
145
  json
139
146
  end
140
147
 
148
+ def site_details(domain)
149
+ json = get("/site/details", :params => { :domain => domain })
150
+ json['site']
151
+ rescue ResourceNotFound
152
+ false
153
+ end
154
+
141
155
  def logout
142
156
  remove_token
143
157
  end
@@ -205,7 +219,7 @@ module Fjords
205
219
  def wait_until_complete(site, &block)
206
220
  sleep(3)
207
221
 
208
- json = get(site["url"])
222
+ json = get("/site/details", :params => { :domain => site["custom_name"] })
209
223
 
210
224
  block.call(json['site']) if block_given?
211
225
 
@@ -218,11 +232,53 @@ module Fjords
218
232
  end
219
233
  end
220
234
 
221
- def sites
222
- json = get("/sites")
235
+ def sites(include_deleted=false)
236
+ json = get("/sites", :params => { :include_deleted => include_deleted })
223
237
  json['sites']
224
238
  end
225
239
 
240
+ def has_cdn(domain)
241
+ json = get("/site/details", :params => { :domain => domain })
242
+ json['site']['cdn_enabled']
243
+ rescue ResourceNotFound
244
+ false
245
+ end
246
+
247
+ def enable_cdn(domain)
248
+ json = post("/cdn/enable", :domain => domain)
249
+ json['site']
250
+ rescue ResourceNotFound
251
+ false
252
+ end
253
+
254
+ def disable_cdn(domain)
255
+ json = post("/cdn/disable", :domain => domain)
256
+ json['site']
257
+ rescue ResourceNotFound
258
+ false
259
+ end
260
+
261
+ def has_gzip(domain)
262
+ json = get("/site/details", :params => { :domain => domain })
263
+ json['site']['gzip_assets']
264
+ rescue ResourceNotFound
265
+ false
266
+ end
267
+
268
+ def enable_gzip(domain)
269
+ json = post("/gzip/enable", :domain => domain)
270
+ json['site']
271
+ rescue ResourceNotFound
272
+ false
273
+ end
274
+
275
+ def disable_gzip(domain)
276
+ json = post("/gzip/disable", :domain => domain)
277
+ json['site']
278
+ rescue ResourceNotFound
279
+ false
280
+ end
281
+
226
282
  def bugreport(body, attach=nil)
227
283
  params = { :body => body }
228
284
  if attach
@@ -1,5 +1,5 @@
1
1
  module Fjords
2
2
  class Client
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fjords-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.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-02-09 00:00:00.000000000 Z
12
+ date: 2013-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -68,6 +68,7 @@ extra_rdoc_files: []
68
68
  files:
69
69
  - .gitignore
70
70
  - Gemfile
71
+ - LICENSE
71
72
  - Rakefile
72
73
  - fjords-client.gemspec
73
74
  - lib/fjords-client.rb
@@ -89,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
90
  version: '0'
90
91
  segments:
91
92
  - 0
92
- hash: 3275000126563766821
93
+ hash: -4162474409175055862
93
94
  required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  none: false
95
96
  requirements:
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  version: '0'
99
100
  segments:
100
101
  - 0
101
- hash: 3275000126563766821
102
+ hash: -4162474409175055862
102
103
  requirements: []
103
104
  rubyforge_project:
104
105
  rubygems_version: 1.8.23