zedkit 1.1.5 → 1.2.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.
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,32 +13,38 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class Configuration
20
- attr_accessor :project_key, :locales_key, :ssl, :exceptions, :api_host, :api_port
20
+ attr_accessor :project_key, :user_key, :locales_key, :ssl, :exceptions, :api_host, :api_port, :debug
21
21
 
22
- API_HOSTNAME = 'api.zedapi.com'
22
+ API_HOSTNAME = "api.zedapi.com"
23
23
  API_PORT = 80
24
24
  PROJECT_KEY_LENGTH = 18
25
25
  LOCALES_KEY_LENGTH = 18
26
26
 
27
27
  def initialize
28
- @project_key, @locales_key = nil, nil
28
+ @project_key, @user_key, @locales_key = nil, nil, nil
29
+ @debug = false
29
30
  @ssl = false
30
31
  @exceptions = false
31
- @api_host = API_HOSTNAME
32
- @api_port = API_PORT
32
+ @api_host, @api_port = API_HOSTNAME, API_PORT
33
33
  end
34
34
 
35
35
  def has_project_key?
36
36
  (not project_key.nil?) && project_key.is_a?(String) && project_key.length == PROJECT_KEY_LENGTH
37
37
  end
38
+ def has_user_key?
39
+ (not user_key.nil?) && user_key.is_a?(String)
40
+ end
38
41
  def has_locales_key?
39
42
  (not locales_key.nil?) && locales_key.is_a?(String) && locales_key.length == LOCALES_KEY_LENGTH
40
43
  end
41
44
 
45
+ def debug?
46
+ debug
47
+ end
42
48
  def ssl?
43
49
  ssl
44
50
  end
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class ZedkitError < StandardError
@@ -0,0 +1,22 @@
1
+ #
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ #
17
+
18
+ class Array
19
+ def has_stuff?
20
+ not empty?
21
+ end
22
+ end
@@ -0,0 +1,38 @@
1
+ #
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ #
17
+
18
+ module Benchmark
19
+ class << self
20
+ def zk_time(method, debug = false)
21
+ rss = nil
22
+ rpp = realtime { rss = yield }
23
+ rtt = ('%.2f' % (rpp * 1000)) << 'ms'
24
+
25
+ if rss.is_a? Array
26
+ lth = rss.length
27
+ elsif rss.is_a? Hash
28
+ lth = 1
29
+ else
30
+ lth = 0 end
31
+
32
+ if debug && defined?(Rails::Railtie)
33
+ Rails.logger.info "Zedkit :#{method.to_s} DONE [#{lth}] (#{rtt})"
34
+ Rails.logger.debug "Zedkit :#{method.to_s} DONE [#{lth}] -> #{rss.inspect} (#{rtt})"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,9 +13,9 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
- ##
18
+ #
19
19
  # We want to transform something like this:
20
20
  # { :user => { :email => "whatever@zedkit.com", :password => "pwd", :first_name => "Fred", :surname => "Flintstone" } }
21
21
  #
@@ -32,7 +32,7 @@
32
32
  # FYI, the API's backend controllers do NOT use mass assignment for attributes submitted, EVER. Submitting anything other
33
33
  # than documented object data items for each API method has no negative impact. Inapplicable attributes, or nefarious
34
34
  # submissions on update, such as user[uuid], are simply ignored.
35
- ##
35
+ #
36
36
 
37
37
  class Hash
38
38
  def flatten_zedkit_params! ## The implementation of this did not require a staging hash until
@@ -48,4 +48,11 @@ class Hash
48
48
  def zdelete_keys!(zedkeys = [])
49
49
  delete_if {|k| zedkeys.include?(k.to_s) }
50
50
  end
51
+
52
+ def zedkit_object?
53
+ self.has_key?('uuid') && self['uuid'].is_a?(String) && self['uuid'].length == 32
54
+ end
55
+ def has_zedkit_errors?
56
+ has_key?("status") && self["status"]["result"] == "ERROR"
57
+ end
51
58
  end
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class Instance < Hash
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class Project < Zedkit::Instance
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  module Sessions
@@ -63,7 +63,7 @@ module Zedkit
63
63
  when :post
64
64
 
65
65
  Rails.logger.info "User Verification Request via Zedkit [#{login.downcase}]"
66
- Zedkit::Users.verify(:username => login.downcase, :password => password) do |json|
66
+ Zedkit::Users.verify(:login => login.downcase, :password => password) do |json|
67
67
  Rails.logger.info "User VERIFIED [#{json['uuid']}]"
68
68
  set_session(json, login.downcase)
69
69
  return true
@@ -0,0 +1,38 @@
1
+ #
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ #
17
+
18
+ module Zedkit
19
+ class BlogPosts
20
+ class << self
21
+ def get(zks = {}, &block)
22
+ Zedkit::Client.crud(:get, "posts/#{zks[:uuid]}", zks, [], &block)
23
+ end
24
+
25
+ def create(zks = {}, &block)
26
+ Zedkit::Client.crud(:create, "posts", zks, [], &block)
27
+ end
28
+
29
+ def update(zks = {}, &block)
30
+ Zedkit::Client.crud(:update, "posts/#{zks[:uuid]}", zks, [], &block)
31
+ end
32
+
33
+ def delete(zks = {}, &block)
34
+ Zedkit::Client.crud(:delete, "posts/#{zks[:uuid]}", zks, [], &block)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,46 @@
1
+ #
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ #
17
+
18
+ module Zedkit
19
+ class Blogs
20
+ class << self
21
+ def get(zks = {}, &block)
22
+ Zedkit::Client.crud(:get, "blogs/#{zks[:uuid]}", zks, [], &block)
23
+ end
24
+
25
+ def create(zks = {}, &block)
26
+ Zedkit::Client.crud(:create, "blogs", zks, [], &block)
27
+ end
28
+
29
+ def update(zks = {}, &block)
30
+ Zedkit::Client.crud(:update, "blogs/#{zks[:uuid]}", zks, [], &block)
31
+ end
32
+
33
+ def delete(zks = {}, &block)
34
+ Zedkit::Client.crud(:delete, "blogs/#{zks[:uuid]}", zks, [], &block)
35
+ end
36
+ end
37
+
38
+ class Posts
39
+ class << self
40
+ def get(zks = {}, &block)
41
+ Zedkit::Client.crud(:get, "posts", zks, [], &block)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class EmailSettings
@@ -23,7 +23,7 @@ module Zedkit
23
23
  end
24
24
 
25
25
  def create(zks = {}, &block)
26
- Zedkit::Client.crud(:create, 'emails/settings', zks, [], &block)
26
+ Zedkit::Client.crud(:create, "emails/settings", zks, [], &block)
27
27
  end
28
28
 
29
29
  def update(zks = {}, &block)
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class Emails
@@ -23,7 +23,7 @@ module Zedkit
23
23
  end
24
24
 
25
25
  def create(zks = {}, &block)
26
- Zedkit::Client.crud(:create, 'emails', zks, [], &block)
26
+ Zedkit::Client.crud(:create, "emails", zks, [], &block)
27
27
  end
28
28
 
29
29
  def update(zks = {}, &block)
@@ -0,0 +1,35 @@
1
+ #
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ #
17
+
18
+ module Zedkit
19
+ class ProjectAdmins
20
+ class << self
21
+ def create(zks = {}, &block)
22
+ Zedkit::Client.crud(:create, "projects/#{zks[:project][:uuid]}/admins", zks, %w(project), &block)
23
+ end
24
+
25
+ def update(zks = {}, &block)
26
+ Zedkit::Client.crud(:update, "projects/#{zks[:project][:uuid]}/admins/#{zks[:admin][:uuid]}", zks,
27
+ %w(project admin), &block)
28
+ end
29
+
30
+ def delete(zks = {}, &block)
31
+ Zedkit::Client.crud(:delete, "projects/#{zks[:project][:uuid]}/admins/#{zks[:admin][:uuid]}", zks, [], &block)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ #
17
+
18
+ module Zedkit
19
+ class ProjectKeys
20
+ class << self
21
+ def create(zks = {}, &block)
22
+ Zedkit::Client.crud(:create, "projects/#{zks[:project][:uuid]}/keys", zks, %w(project), &block)
23
+ end
24
+
25
+ def update(zks = {}, &block)
26
+ Zedkit::Client.crud(:update, "projects/#{zks[:project][:uuid]}/keys/#{zks[:key][:uuid]}", zks, %w(project key), &block)
27
+ end
28
+
29
+ def delete(zks = {}, &block)
30
+ Zedkit::Client.crud(:delete, "projects/#{zks[:project][:uuid]}/keys/#{zks[:key][:uuid]}", zks, [], &block)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,4 +1,4 @@
1
- ##
1
+ #
2
2
  # Copyright (c) Zedkit.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
@@ -13,7 +13,7 @@
13
13
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
14
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
15
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- ##
16
+ #
17
17
 
18
18
  module Zedkit
19
19
  class Projects
@@ -22,64 +22,68 @@ module Zedkit
22
22
  rs = nil
23
23
  case type.to_sym
24
24
  when :project
25
- rs = Zedkit::Client.get('projects/verify', nil)
25
+ rs = Zedkit::Client.get("projects/verify", nil)
26
26
  when :locales
27
- rs = Zedkit::Client.get('projects/verify/locales', nil, { :locales_key => key })
27
+ rs = Zedkit::Client.get("projects/verify/locales", nil, { :locales_key => key })
28
28
  end
29
29
  yield(rs) if rs && block_given?
30
30
  rs
31
31
  end
32
+ def snapshot(zks = {}, &block)
33
+ Zedkit::Client.get("projects/#{zks[:uuid]}/snapshot", zks[:user_key], {}, &block)
34
+ end
32
35
 
33
36
  def get(zks = {}, &block) ## This avoids /projects/[nil] which is a
34
- zks[:uuid] = 'uuid' if zks[:uuid].nil? ## valid resource to list a user's projects.
37
+ zks[:uuid] = "uuid" if zks[:uuid].nil? ## valid resource to list a user"s projects.
35
38
  Zedkit::Client.crud(:get, "projects/#{zks[:uuid]}", zks, [], &block)
36
39
  end
37
40
 
38
41
  def create(zks = {}, &block)
39
- Zedkit::Client.crud(:create, 'projects', zks, [], &block)
42
+ Zedkit::Client.crud(:create, "projects", zks, [], &block)
40
43
  end
41
44
 
42
45
  def update(zks = {}, &block)
43
46
  Zedkit::Client.crud(:update, "projects/#{zks[:uuid]}", zks, [], &block)
44
47
  end
45
-
48
+
46
49
  def delete(zks = {}, &block)
47
50
  Zedkit::Client.crud(:delete, "projects/#{zks[:uuid]}", zks, [], &block)
48
51
  end
49
52
  end
50
53
 
51
- class Users
54
+ class ProjectKeys
52
55
  class << self
53
56
  def get(zks = {}, &block)
54
- Zedkit::Client.crud(:get, "projects/#{zks[:project][:uuid]}/users", zks, %w(project), &block)
57
+ Zedkit::Client.crud(:get, "projects/#{zks[:project][:uuid]}/keys", zks, %w(project), &block)
55
58
  end
56
-
57
- def create(zks = {}, &block)
58
- Zedkit::Client.crud(:create, "projects/#{zks[:project][:uuid]}/users", zks, %w(project), &block)
59
- end
60
-
61
- def update(zks = {}, &block)
62
- Zedkit::Client.crud(:update,
63
- "projects/#{zks[:project][:uuid]}/users/#{zks[:user][:uuid]}", zks, %w(project), &block)
59
+ end
60
+ end
61
+ class ProjectAdmins
62
+ class << self
63
+ def get(zks = {}, &block)
64
+ Zedkit::Client.crud(:get, "projects/#{zks[:project][:uuid]}/admins", zks, %w(project), &block)
64
65
  end
66
+ end
67
+ end
65
68
 
66
- def delete(zks = {}, &block)
67
- Zedkit::Client.crud(:delete, "projects/#{zks[:project][:uuid]}/users/#{zks[:user][:uuid]}", zks, [], &block)
69
+ class Blogs
70
+ class << self
71
+ def get(zks = {}, &block)
72
+ Zedkit::Client.crud(:get, "blogs", zks, [], &block)
68
73
  end
69
74
  end
70
75
  end
71
-
72
76
  class Emails
73
77
  class << self
74
78
  def get(zks = {}, &block)
75
- Zedkit::Client.crud(:get, 'emails', zks, [], &block)
79
+ Zedkit::Client.crud(:get, "emails", zks, [], &block)
76
80
  end
77
81
  end
78
82
  end
79
83
  class EmailSettings
80
84
  class << self
81
85
  def get(zks = {}, &block)
82
- Zedkit::Client.crud(:get, 'emails/settings', zks, [], &block)
86
+ Zedkit::Client.crud(:get, "emails/settings", zks, [], &block)
83
87
  end
84
88
  end
85
89
  end