zedkit 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +15 -0
- data/README.rdoc +8 -0
- data/Rakefile +75 -0
- data/VERSION +1 -0
- data/bin/zedkit +23 -0
- data/lib/cli/config.rb +20 -0
- data/lib/zedkit/cli/bottom.rb +32 -0
- data/lib/zedkit/cli/exceptions.rb +49 -0
- data/lib/zedkit/cli/projects.rb +56 -0
- data/lib/zedkit/cli/runner.rb +144 -0
- data/lib/zedkit/cli/text.rb +82 -0
- data/lib/zedkit/client/client.rb +108 -0
- data/lib/zedkit/client/configuration.rb +53 -0
- data/lib/zedkit/client/exceptions.rb +67 -0
- data/lib/zedkit/ext/hash.rb +51 -0
- data/lib/zedkit/instances/instance.rb +50 -0
- data/lib/zedkit/instances/project.rb +43 -0
- data/lib/zedkit/resources/projects.rb +77 -0
- data/lib/zedkit/resources/users.rb +44 -0
- data/lib/zedkit.rb +71 -0
- data/test/helper.rb +41 -0
- data/test/test_emails.rb +21 -0
- data/test/test_entities.rb +64 -0
- data/test/test_projects.rb +139 -0
- data/test/test_users.rb +81 -0
- metadata +120 -0
@@ -0,0 +1,139 @@
|
|
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 TestProjects < Test::Unit::TestCase
|
21
|
+
def test_does_not_verify_invalid_locales_key
|
22
|
+
assert_nil Zedkit::Projects.verify(:locales, 'not.a.valid.key')
|
23
|
+
end
|
24
|
+
def test_verify_locales_key
|
25
|
+
pp = Zedkit::Projects.verify(:locales, TEST_GEMS_LOCALES_KEY)
|
26
|
+
assert_equal 32, pp['uuid'].length
|
27
|
+
assert_equal 'Zedkit Gems', pp['name']
|
28
|
+
end
|
29
|
+
def test_verify_locales_key_with_block
|
30
|
+
Zedkit::Projects.verify(:locales, TEST_GEMS_LOCALES_KEY) do |pp|
|
31
|
+
assert_equal 32, pp['uuid'].length
|
32
|
+
assert_equal 'Zedkit Gems', pp['name']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_verify_project_key
|
37
|
+
pp = Zedkit::Projects.verify(:project)
|
38
|
+
assert_equal 32, pp['uuid'].length
|
39
|
+
assert_equal 'Zedkit Gems', pp['name']
|
40
|
+
end
|
41
|
+
def test_verify_project_key_with_block
|
42
|
+
Zedkit::Projects.verify(:project) do |pp|
|
43
|
+
assert_equal 32, pp['uuid'].length
|
44
|
+
assert_equal 'Zedkit Gems', pp['name']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
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']
|
55
|
+
end
|
56
|
+
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']
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_create
|
64
|
+
end
|
65
|
+
def test_create_with_block
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_update
|
69
|
+
end
|
70
|
+
def test_update_with_block
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_delete
|
74
|
+
end
|
75
|
+
def test_delete_with_block
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def test_get_user_connections
|
80
|
+
us = Zedkit::Projects::Users.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] })
|
81
|
+
assert us.is_a? Array
|
82
|
+
assert_equal 3, us.length
|
83
|
+
assert us.detect {|pu| pu['user']['uuid'] == @uu['uuid'] }
|
84
|
+
end
|
85
|
+
def test_get_user_connections_in_block
|
86
|
+
Zedkit::Projects::Users.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] }) do |pu|
|
87
|
+
assert_not_nil pu['user']['uuid']
|
88
|
+
assert_not_nil pu['role']
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_create_user_connection
|
93
|
+
end
|
94
|
+
def test_create_user_connection_with_block
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_update_user_connection
|
98
|
+
lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
|
99
|
+
uu = Zedkit::Projects::Users.update(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
|
100
|
+
:user => { :uuid => lk['uuid'], :role => 'C' })
|
101
|
+
assert uu.is_a? Hash
|
102
|
+
assert_equal 'C', uu['role']['code']
|
103
|
+
end
|
104
|
+
def test_update_user_connection_with_block
|
105
|
+
lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
|
106
|
+
Zedkit::Projects::Users.update(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
|
107
|
+
:user => { :uuid => lk['uuid'], :role => 'C' }) do |uu|
|
108
|
+
assert uu.is_a? Hash
|
109
|
+
assert_equal 'C', uu['role']['code']
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_delete_user_connection
|
114
|
+
lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
|
115
|
+
ud = Zedkit::Projects::Users.delete(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
|
116
|
+
:user => { :uuid => lk['uuid'] })
|
117
|
+
assert_equal ud, {}
|
118
|
+
end
|
119
|
+
def test_delete_user_connection_with_block
|
120
|
+
lk = Zedkit::Users.verify(:username => TEST_GEMS_LACKY, :password => TEST_GEMS_PASSWORD)
|
121
|
+
Zedkit::Projects::Users.delete(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] },
|
122
|
+
:user => { :uuid => lk['uuid'] }) do |ud|
|
123
|
+
assert_equal ud, {}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
def test_get_emails
|
129
|
+
ee = Zedkit::Projects::Emails.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] })
|
130
|
+
assert_not_nil ee
|
131
|
+
assert ee.is_a? Array
|
132
|
+
end
|
133
|
+
def test_get_emails_with_block
|
134
|
+
Zedkit::Projects::Emails.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] }) do |ee|
|
135
|
+
assert_not_nil ee
|
136
|
+
assert ee.is_a? Array
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
data/test/test_users.rb
ADDED
@@ -0,0 +1,81 @@
|
|
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 TestUsers < Test::Unit::TestCase
|
21
|
+
def test_verify_fails
|
22
|
+
assert_nil Zedkit::Users.verify(:username => TEST_GEMS_LOGIN, :password => 'not.the.password')
|
23
|
+
end
|
24
|
+
def test_verify
|
25
|
+
assert @uu.is_a? Hash
|
26
|
+
assert_equal 32, @uu['uuid'].length
|
27
|
+
assert_equal TEST_GEMS_LOGIN, @uu['email']
|
28
|
+
end
|
29
|
+
def test_verify_with_block
|
30
|
+
Zedkit::Users.verify(:username => TEST_GEMS_LOGIN, :password => TEST_GEMS_PASSWORD) do |uu|
|
31
|
+
assert @uu.is_a? Hash
|
32
|
+
assert_equal 32, @uu['uuid'].length
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_projects_list
|
37
|
+
pp = Zedkit::Users::Projects.get(:user_key => @uu['user_key'], :whatever => "yo")
|
38
|
+
assert pp.is_a? Array
|
39
|
+
assert_equal 1, pp.length
|
40
|
+
end
|
41
|
+
def test_projects_list_with_block
|
42
|
+
Zedkit::Users::Projects.get(:user_key => @uu['user_key']) do |pp|
|
43
|
+
assert_not_nil pp['project']
|
44
|
+
assert_not_nil pp['permissions']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_get_fails
|
49
|
+
assert_nil Zedkit::Users.get(:user_key => 'whatever', :uuid => 'notvaliduuid')
|
50
|
+
end
|
51
|
+
def test_get
|
52
|
+
uu = Zedkit::Users.get(:user_key => @uu['user_key'], :uuid => @uu['uuid'])
|
53
|
+
assert uu.is_a? Hash
|
54
|
+
assert_equal 32, uu['uuid'].length
|
55
|
+
assert_equal TEST_GEMS_LOGIN, uu['email']
|
56
|
+
end
|
57
|
+
def test_get_with_block
|
58
|
+
Zedkit::Users.get(:user_key => @uu['user_key'], :uuid => @uu['uuid']) do |uu|
|
59
|
+
assert uu.is_a? Hash
|
60
|
+
assert_equal 32, uu['uuid'].length
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_create
|
65
|
+
uu = Zedkit::Users.create(:user_key => @uu['user_key'], :user => { :first_name => 'Fred', :surname => 'Flinstone',
|
66
|
+
:email => 'gemusertest@zedkit.com',
|
67
|
+
:password => 'password' })
|
68
|
+
assert uu.is_a? Hash
|
69
|
+
assert_equal 32, uu['uuid'].length
|
70
|
+
assert_equal 'Fred', uu['first_name']
|
71
|
+
assert_equal 'gemusertest@zedkit.com', uu['email']
|
72
|
+
end
|
73
|
+
def test_create_with_block
|
74
|
+
Zedkit::Users.create(:user_key => @uu['user_key'], :user => { :first_name => 'Fred', :surname => 'Flinstone',
|
75
|
+
:email => 'gemusertest@zedkit.com',
|
76
|
+
:password => 'password' }) do |uu|
|
77
|
+
assert uu.is_a? Hash
|
78
|
+
assert_equal 32, uu['uuid'].length
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zedkit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
version: 1.1.3
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Zedkit
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-14 00:00:00 -08:00
|
18
|
+
default_executable: zedkit
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: json
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 4
|
31
|
+
- 0
|
32
|
+
version: 1.4.0
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: nestful
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: gem for Zedkit with all the applicable good stuff easily accessible
|
49
|
+
email: support@zedkit.com
|
50
|
+
executables:
|
51
|
+
- zedkit
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files:
|
55
|
+
- LICENSE
|
56
|
+
- README.rdoc
|
57
|
+
files:
|
58
|
+
- LICENSE
|
59
|
+
- README.rdoc
|
60
|
+
- Rakefile
|
61
|
+
- VERSION
|
62
|
+
- bin/zedkit
|
63
|
+
- lib/cli/config.rb
|
64
|
+
- lib/zedkit.rb
|
65
|
+
- lib/zedkit/cli/bottom.rb
|
66
|
+
- lib/zedkit/cli/exceptions.rb
|
67
|
+
- lib/zedkit/cli/projects.rb
|
68
|
+
- lib/zedkit/cli/runner.rb
|
69
|
+
- lib/zedkit/cli/text.rb
|
70
|
+
- lib/zedkit/client/client.rb
|
71
|
+
- lib/zedkit/client/configuration.rb
|
72
|
+
- lib/zedkit/client/exceptions.rb
|
73
|
+
- lib/zedkit/ext/hash.rb
|
74
|
+
- lib/zedkit/instances/instance.rb
|
75
|
+
- lib/zedkit/instances/project.rb
|
76
|
+
- lib/zedkit/resources/projects.rb
|
77
|
+
- lib/zedkit/resources/users.rb
|
78
|
+
- test/helper.rb
|
79
|
+
- test/test_emails.rb
|
80
|
+
- test/test_entities.rb
|
81
|
+
- test/test_projects.rb
|
82
|
+
- test/test_users.rb
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: http://github.com/zedkit/zedkit
|
85
|
+
licenses: []
|
86
|
+
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
requirements: []
|
109
|
+
|
110
|
+
rubyforge_project: zedkit
|
111
|
+
rubygems_version: 1.3.7
|
112
|
+
signing_key:
|
113
|
+
specification_version: 3
|
114
|
+
summary: gem for Zedkit
|
115
|
+
test_files:
|
116
|
+
- test/helper.rb
|
117
|
+
- test/test_emails.rb
|
118
|
+
- test/test_entities.rb
|
119
|
+
- test/test_projects.rb
|
120
|
+
- test/test_users.rb
|