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.
@@ -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 ShortenedUrls
20
+ class << self
21
+ def get(zks = {}, &block)
22
+ Zedkit::Client.crud(:get, "urls/#{zks[:uuid]}", zks, %(uuid), &block)
23
+ end
24
+
25
+ def create(zks = {}, &block)
26
+ Zedkit::Client.crud(:create, "urls", zks, [], &block)
27
+ end
28
+
29
+ def update(zks = {}, &block)
30
+ Zedkit::Client.crud(:update, "urls/#{zks[:uuid]}", zks, %(uuid), &block)
31
+ end
32
+
33
+ def delete(zks = {}, &block)
34
+ Zedkit::Client.crud(:delete, "urls/#{zks[:uuid]}", zks, %(uuid), &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 Shorteners
20
+ class << self
21
+ def get(zks = {}, &block)
22
+ Zedkit::Client.crud(:get, "shorteners/#{zks[:uuid]}", zks, [], &block)
23
+ end
24
+
25
+ def create(zks = {}, &block)
26
+ Zedkit::Client.crud(:create, "shorteners", zks, [], &block)
27
+ end
28
+
29
+ def update(zks = {}, &block)
30
+ Zedkit::Client.crud(:update, "shorteners/#{zks[:uuid]}", zks, %(uuid), &block)
31
+ end
32
+
33
+ def delete(zks = {}, &block)
34
+ Zedkit::Client.crud(:delete, "shorteners/#{zks[:uuid]}", zks, %(uuid), &block)
35
+ end
36
+ end
37
+
38
+ class Urls
39
+ class << self
40
+ def get(zks = {}, &block)
41
+ Zedkit::Client.crud(:get, "urls", 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,13 +13,13 @@
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 Users
20
20
  class << self
21
21
  def verify(zks = {}, &block)
22
- rs = Zedkit::Client.verify(zks[:username], zks[:password])
22
+ rs = Zedkit::Client.verify(zks[:login], zks[:password])
23
23
  yield(rs) if rs && block_given?
24
24
  rs
25
25
  end
@@ -29,7 +29,7 @@ module Zedkit
29
29
  end
30
30
 
31
31
  def create(zks = {}, &block)
32
- Zedkit::Client.crud(:create, 'users', zks, [], &block)
32
+ Zedkit::Client.crud(:create, "users", zks, [], &block)
33
33
  end
34
34
 
35
35
  def update(zks = {}, &block)
@@ -39,7 +39,7 @@ module Zedkit
39
39
  class Projects
40
40
  class << self
41
41
  def get(zks = {}, &block)
42
- Zedkit::Client.crud(:get, 'projects', zks, [], &block)
42
+ Zedkit::Client.crud(:get, "projects", zks, [], &block)
43
43
  end
44
44
  end
45
45
  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,29 +13,29 @@
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
- require 'test/unit'
19
- require 'rubygems'
20
- require 'zedkit'
18
+ require "test/unit"
19
+ require "rubygems"
20
+ require "zedkit"
21
21
 
22
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
22
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
23
23
  $LOAD_PATH.unshift(File.dirname(__FILE__))
24
24
 
25
25
  class Test::Unit::TestCase
26
- TEST_GEMS_PROJECT_KEY = 'BE1OZog8gJogtQTosh'
27
- TEST_GEMS_LOCALES_KEY = '6yca7DsnBvaDVupKEZ'
28
- TEST_GEMS_LOGIN = 'gems@zedkit.com'
29
- TEST_GEMS_LACKY = 'gems_lacky@zedkit.com'
30
- TEST_GEMS_TEMP = 'temp@zedkit.com'
31
- TEST_GEMS_PASSWORD = 'NGIaDhr5vDlXo1tDs6bW3Gd'
26
+ TEST_GEMS_PROJECT_KEY = "BE1OZog8gJogtQTosh"
27
+ TEST_GEMS_LOCALES_KEY = "6yca7DsnBvaDVupKEZ"
28
+ TEST_GEMS_LOGIN = "gems@zedkit.com"
29
+ TEST_GEMS_LACKY = "lacky@zedkit.com"
30
+ TEST_GEMS_TEMP = "temp@zedkit.com"
31
+ TEST_GEMS_PASSWORD = "NGIaDhr5vDlXo1tDs6bW3Gd"
32
32
 
33
33
  def setup
34
34
  Zedkit.configure do |zk|
35
+ zk.api_host = "127.0.0.1"
36
+ zk.api_port = "3000"
35
37
  zk.project_key = TEST_GEMS_PROJECT_KEY
36
- # zk.api_host = '0.0.0.0'
37
- # zk.api_port = 5010
38
38
  end
39
- @uu = Zedkit::Users.verify(:username => TEST_GEMS_LOGIN, :password => TEST_GEMS_PASSWORD)
39
+ @uu = Zedkit::Users.verify(:login => TEST_GEMS_LOGIN, :password => TEST_GEMS_PASSWORD)
40
40
  end
41
41
  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
+ require "helper"
19
+
20
+ class TestBlogPosts < Test::Unit::TestCase
21
+ def test_get
22
+ end
23
+ def test_get_with_block
24
+ end
25
+
26
+ def test_create
27
+ end
28
+ def test_create_with_block
29
+ end
30
+
31
+ def test_update
32
+ end
33
+ def test_update_with_block
34
+ end
35
+
36
+ def test_delete
37
+ end
38
+ end
@@ -0,0 +1,41 @@
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
+ require "helper"
19
+
20
+ class TestBlogs < Test::Unit::TestCase
21
+ def test_get
22
+ end
23
+ def test_get_with_block
24
+ end
25
+
26
+ def test_create
27
+ bb = Zedkit::Blogs.create(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] },
28
+ :blog => { :name => "whatever" })
29
+ assert_equal "whatever", bb["name"]
30
+ end
31
+ def test_create_with_block
32
+ end
33
+
34
+ def test_update
35
+ end
36
+ def test_update_with_block
37
+ end
38
+
39
+ def test_delete
40
+ end
41
+ 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
- require 'helper'
18
+ require "helper"
19
19
 
20
20
  class TestEmailSettings < Test::Unit::TestCase
21
21
  def test_get
@@ -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
- require 'helper'
18
+ require "helper"
19
19
 
20
20
  class TestEmails < Test::Unit::TestCase
21
21
  def test_get
@@ -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,22 +13,22 @@
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
- require 'helper'
18
+ require "helper"
19
19
 
20
20
  class TestEntities < Test::Unit::TestCase
21
21
  def test_entities
22
22
  zkes = Zedkit.entities
23
- assert_not_nil zkes['languages']
24
- assert_not_nil zkes['locales']
25
- assert_not_nil zkes['timezones']
23
+ assert_not_nil zkes["languages"]
24
+ assert_not_nil zkes["locales"]
25
+ assert_not_nil zkes["timezones"]
26
26
  end
27
27
  def test_entities_with_block
28
28
  Zedkit.entities do |zkes|
29
- assert_not_nil zkes['languages']
30
- assert_not_nil zkes['locales']
31
- assert_not_nil zkes['timezones']
29
+ assert_not_nil zkes["languages"]
30
+ assert_not_nil zkes["locales"]
31
+ assert_not_nil zkes["timezones"]
32
32
  end
33
33
  end
34
34
 
@@ -39,32 +39,32 @@ class TestEntities < Test::Unit::TestCase
39
39
  end
40
40
  def test_countries_with_block
41
41
  Zedkit.countries do |cnts|
42
- assert_not_nil cnts['code']
43
- assert_not_nil cnts['name']
44
- assert_not_nil cnts['locale']
42
+ assert_not_nil cnts["code"]
43
+ assert_not_nil cnts["name"]
44
+ assert_not_nil cnts["locale"]
45
45
  end
46
46
  end
47
47
 
48
48
  def test_regions
49
49
  rgss = Zedkit.regions
50
50
  assert rgss.is_a? Array
51
- assert_not_nil rgss.detect {|region| region['code'] == 'WA' }
52
- assert_not_nil rgss.detect {|region| region['code'] == 'BC' }
51
+ assert_not_nil rgss.detect {|region| region["code"] == "WA" }
52
+ assert_not_nil rgss.detect {|region| region["code"] == "BC" }
53
53
  end
54
54
  def test_regions_with_block
55
55
  Zedkit.regions do |rgss|
56
- assert_not_nil rgss['code']
57
- assert_not_nil rgss['name']
56
+ assert_not_nil rgss["code"]
57
+ assert_not_nil rgss["name"]
58
58
  end
59
59
  end
60
60
  def test_states_for_usa
61
- rgss = Zedkit.regions(:country => { :code => 'US' })
61
+ rgss = Zedkit.regions(:country => { :code => "US" })
62
62
  assert rgss.is_a? Array
63
- assert_nil rgss.detect {|region| region['code'] == 'BC' }
63
+ assert_nil rgss.detect {|region| region["code"] == "BC" }
64
64
  end
65
65
  def test_provinces_for_canada
66
- rgss = Zedkit.regions(:country => { :code => 'CA' })
66
+ rgss = Zedkit.regions(:country => { :code => "CA" })
67
67
  assert rgss.is_a? Array
68
- assert_nil rgss.detect {|region| region['code'] == 'WA' }
68
+ assert_nil rgss.detect {|region| region["code"] == "WA" }
69
69
  end
70
70
  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,97 +13,107 @@
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
- require 'helper'
18
+ require "helper"
19
19
 
20
20
  class TestProjects < Test::Unit::TestCase
21
+ def test_snapshot
22
+ sn = Zedkit::Projects.snapshot(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
23
+ assert_not_nil sn["project"]
24
+ end
25
+ def test_snapshot_with_block
26
+ Zedkit::Projects.snapshot(:user_key => @uu["user_key"], :uuid => @uu["projects"][0]) do |sn|
27
+ assert_not_nil sn["project"]
28
+ end
29
+ end
30
+
21
31
  def test_does_not_verify_invalid_locales_key
22
- assert_nil Zedkit::Projects.verify(:locales, 'not.a.valid.key')
32
+ assert_nil Zedkit::Projects.verify(:locales, "not.a.valid.key")
23
33
  end
24
34
  def test_verify_locales_key
25
35
  pp = Zedkit::Projects.verify(:locales, TEST_GEMS_LOCALES_KEY)
26
- assert_equal 32, pp['uuid'].length
27
- assert_equal 'Zedkit Gems', pp['name']
36
+ assert_equal 32, pp["uuid"].length
37
+ assert_equal "Zedkit Gems", pp["name"]
28
38
  end
29
39
  def test_verify_locales_key_with_block
30
40
  Zedkit::Projects.verify(:locales, TEST_GEMS_LOCALES_KEY) do |pp|
31
- assert_equal 32, pp['uuid'].length
32
- assert_equal 'Zedkit Gems', pp['name']
41
+ assert_equal 32, pp["uuid"].length
42
+ assert_equal "Zedkit Gems", pp["name"]
33
43
  end
34
44
  end
35
45
 
36
46
  def test_verify_project_key
37
47
  pp = Zedkit::Projects.verify(:project)
38
- assert_equal 32, pp['uuid'].length
39
- assert_equal 'Zedkit Gems', pp['name']
48
+ assert_equal 32, pp["uuid"].length
49
+ assert_equal "Zedkit Gems", pp["name"]
40
50
  end
41
51
  def test_verify_project_key_with_block
42
52
  Zedkit::Projects.verify(:project) do |pp|
43
- assert_equal 32, pp['uuid'].length
44
- assert_equal 'Zedkit Gems', pp['name']
53
+ assert_equal 32, pp["uuid"].length
54
+ assert_equal "Zedkit Gems", pp["name"]
45
55
  end
46
56
  end
47
57
 
48
58
 
49
59
  def test_get
50
- pp = Zedkit::Projects.get(:user_key => @uu['user_key'], :uuid => @uu['projects'][0])
51
- assert_equal 'Zedkit Gems', pp['name']
52
- assert_not_nil pp['uuid']
53
- assert_not_nil pp['locales']
54
- assert_not_nil pp['location']
60
+ pp = Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
61
+ assert_equal "Zedkit Gems", pp["name"]
62
+ assert_not_nil pp["uuid"]
63
+ assert_not_nil pp["locales"]
64
+ assert_not_nil pp["location"]
55
65
  end
56
66
  def test_get_with_block
57
- Zedkit::Projects.get(:user_key => @uu['user_key'], :uuid => @uu['projects'][0]) do |pp|
58
- assert_equal 'Zedkit Gems', pp['name']
59
- assert_not_nil pp['uuid']
67
+ Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0]) do |pp|
68
+ assert_equal "Zedkit Gems", pp["name"]
69
+ assert_not_nil pp["uuid"]
60
70
  end
61
71
  end
62
72
 
63
73
  def test_create
64
- pp = Zedkit::Projects.create(:user_key => @uu['user_key'], :project => { :name => "new_project" })
65
- assert_not_nil pp['location']
66
- assert_equal 'new_project', pp['name']
74
+ pp = Zedkit::Projects.create(:user_key => @uu["user_key"], :project => { :name => "new_project" })
75
+ assert_not_nil pp["location"]
76
+ assert_equal "new_project", pp["name"]
67
77
  end
68
78
  def test_create_with_block
69
- Zedkit::Projects.create(:user_key => @uu['user_key'], :project => { :name => "new_project" }) do |pp|
70
- assert_not_nil pp['location']
71
- assert_equal 'new_project', pp['name']
79
+ Zedkit::Projects.create(:user_key => @uu["user_key"], :project => { :name => "new_project" }) do |pp|
80
+ assert_not_nil pp["location"]
81
+ assert_equal "new_project", pp["name"]
72
82
  end
73
83
  end
74
84
 
75
85
  def test_update
76
- pp = Zedkit::Projects.get(:user_key => @uu['user_key'], :uuid => @uu['projects'][0])
77
- uu = Zedkit::Projects.update(:user_key => @uu['user_key'], :uuid => pp['uuid'],
86
+ pp = Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
87
+ uu = Zedkit::Projects.update(:user_key => @uu["user_key"], :uuid => pp["uuid"],
78
88
  :project => { :location => "new_location" })
79
- assert_equal 'http://new_location.zedapi.com', uu['location']
80
- assert_equal pp['uuid'], uu['uuid']
89
+ assert_equal "http://new_location.zedapi.com", uu["location"]
90
+ assert_equal pp["uuid"], uu["uuid"]
81
91
  end
82
92
  def test_update_with_block
83
- Zedkit::Projects.get(:user_key => @uu['user_key'], :uuid => @uu['projects'][0]) do |pp|
84
- Zedkit::Projects.update(:user_key => @uu['user_key'], :uuid => pp['uuid'],
93
+ Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0]) do |pp|
94
+ Zedkit::Projects.update(:user_key => @uu["user_key"], :uuid => pp["uuid"],
85
95
  :project => { :location => "new_location" }) do |uu|
86
- assert_equal 'http://new_location.zedapi.com', uu['location']
87
- assert_equal pp['uuid'], uu['uuid']
96
+ assert_equal "http://new_location.zedapi.com", uu["location"]
97
+ assert_equal pp["uuid"], uu["uuid"]
88
98
  end
89
99
  end
90
100
  end
91
101
 
92
102
  def test_delete
93
- assert_nil Zedkit::Projects.delete(:user_key => @uu['user_key'], :uuid => @uu['projects'][0])
103
+ assert_nil Zedkit::Projects.delete(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
94
104
  end
95
105
 
96
106
 
97
107
  def test_get_user_connections
98
- us = Zedkit::Projects::Users.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] })
108
+ us = Zedkit::Projects::ProjectAdmins.get(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] })
99
109
  assert us.is_a? Array
100
- assert_equal 3, us.length
101
- assert us.detect {|pu| pu['user']['uuid'] == @uu['uuid'] }
110
+ assert_equal 2, us.length
111
+ assert us.detect {|pu| pu["user"]["uuid"] == @uu["uuid"] }
102
112
  end
103
113
  def test_get_user_connections_in_block
104
- Zedkit::Projects::Users.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] }) do |pu|
105
- assert_not_nil pu['user']['uuid']
106
- assert_not_nil pu['role']
114
+ Zedkit::Projects::ProjectAdmins.get(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] }) do |pu|
115
+ assert_not_nil pu["user"]["uuid"]
116
+ assert_not_nil pu["role"]
107
117
  end
108
118
  end
109
119
 
@@ -113,45 +123,53 @@ class TestProjects < Test::Unit::TestCase
113
123
  end
114
124
 
115
125
  def test_update_user_connection
116
- lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
117
- uu = Zedkit::Projects::Users.update(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
118
- :user => { :uuid => lk['uuid'], :role => 'C' })
126
+ pp = Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
127
+ lk = Zedkit::Users.verify(:login => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
128
+ uu = Zedkit::ProjectAdmins.update(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] },
129
+ :admin => { :uuid => pp["admins"][1] },
130
+ :user => { :role => "P" })
119
131
  assert uu.is_a? Hash
120
- assert_equal 'C', uu['role']['code']
132
+ assert_equal "P", uu["role"]["code"]
121
133
  end
122
134
  def test_update_user_connection_with_block
123
- lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
124
- Zedkit::Projects::Users.update(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
125
- :user => { :uuid => lk['uuid'], :role => 'C' }) do |uu|
135
+ pp = Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
136
+ lk = Zedkit::Users.verify(:login => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
137
+ Zedkit::ProjectAdmins.update(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] },
138
+ :admin => { :uuid => pp["admins"][1] },
139
+ :user => { :role => "P" }) do |uu|
126
140
  assert uu.is_a? Hash
127
- assert_equal 'C', uu['role']['code']
141
+ assert_equal "P", uu["role"]["code"]
128
142
  end
129
143
  end
130
144
 
131
145
  def test_delete_user_connection
132
- lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
133
- ud = Zedkit::Projects::Users.delete(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
134
- :user => { :uuid => lk['uuid'] })
146
+ pp = Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
147
+ lk = Zedkit::Users.verify(:login => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
148
+ ud = Zedkit::ProjectAdmins.delete(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] },
149
+ :admin => { :uuid => pp["admins"][1] },
150
+ :user => { :uuid => lk["uuid"] })
135
151
  assert_nil ud
136
152
  end
137
153
  def test_delete_user_connection_with_block
138
- lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
139
- Zedkit::Projects::Users.delete(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
140
- :user => { :uuid => lk['uuid'] }) do |ud|
154
+ pp = Zedkit::Projects.get(:user_key => @uu["user_key"], :uuid => @uu["projects"][0])
155
+ lk = Zedkit::Users.verify(:login => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
156
+ Zedkit::ProjectAdmins.delete(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] },
157
+ :admin => { :uuid => pp["admins"][1] },
158
+ :user => { :uuid => lk["uuid"] }) do |ud|
141
159
  assert_nil ud
142
160
  end
143
161
  end
144
162
 
145
163
 
146
164
  def test_get_emails
147
- ee = Zedkit::Projects::Emails.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] })
148
- assert_not_nil ee
149
- assert ee.is_a? Array
165
+ # ee = Zedkit::Projects::Emails.get(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] })
166
+ # assert_not_nil ee
167
+ # assert ee.is_a? Array
150
168
  end
151
169
  def test_get_emails_with_block
152
- Zedkit::Projects::Emails.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] }) do |ee|
153
- assert_not_nil ee
154
- assert ee.is_a? Array
155
- end
170
+ # Zedkit::Projects::Emails.get(:user_key => @uu["user_key"], :project => { :uuid => @uu["projects"][0] }) do |ee|
171
+ # assert_not_nil ee
172
+ # assert ee.is_a? Array
173
+ # end
156
174
  end
157
175
  end