kynetx_am_api 0.1.10 → 0.1.11
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/LICENSE +19 -16
- data/lib/kynetx_am_api/user.rb +35 -10
- metadata +2 -2
data/LICENSE
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
|
2
|
-
a copy of this software and associated documentation files (the
|
3
|
-
"Software"), to deal in the Software without restriction, including
|
4
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
5
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
6
|
-
permit persons to whom the Software is furnished to do so, subject to
|
7
|
-
the following conditions:
|
1
|
+
The MIT License
|
8
2
|
|
9
|
-
|
10
|
-
included in all copies or substantial portions of the Software.
|
3
|
+
Copyright (c) 2010 Kynetx Inc.
|
11
4
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/lib/kynetx_am_api/user.rb
CHANGED
@@ -1,17 +1,40 @@
|
|
1
1
|
module KynetxAmApi
|
2
|
+
#
|
3
|
+
# Simple wrapper to allow access to the OAuth user information. This also hold some basic user data like
|
4
|
+
# username, name and user id.
|
5
|
+
#
|
2
6
|
class User
|
7
|
+
# OAuth Request Token
|
3
8
|
attr_accessor :request_token
|
9
|
+
# OAuth Secret Token
|
4
10
|
attr_accessor :request_secret
|
11
|
+
# OAuth Verifieer
|
5
12
|
attr_accessor :oauth_verifier
|
13
|
+
# OAuth Access Token
|
6
14
|
attr_accessor :access_token
|
15
|
+
# OAuth Acces sSecret
|
7
16
|
attr_accessor :access_secret
|
17
|
+
# Kynetx User name
|
8
18
|
attr_accessor :username
|
19
|
+
# Kynetx User ID
|
9
20
|
attr_accessor :userid
|
21
|
+
# Full name of user
|
10
22
|
attr_accessor :name
|
23
|
+
# Current Application context.
|
11
24
|
attr_reader :current_application
|
12
25
|
|
13
|
-
|
14
|
-
#
|
26
|
+
|
27
|
+
#
|
28
|
+
# Accepts a hash that has the following entries.
|
29
|
+
# - :request_token
|
30
|
+
# - :request_secret
|
31
|
+
# - :oauth_verifier
|
32
|
+
# - :access_token
|
33
|
+
# - :access_secret
|
34
|
+
# - :username
|
35
|
+
# - :userid
|
36
|
+
# - :name
|
37
|
+
#
|
15
38
|
|
16
39
|
def initialize(attributes)
|
17
40
|
@request_token = attributes[:request_token]
|
@@ -25,7 +48,9 @@ module KynetxAmApi
|
|
25
48
|
@current_applicaion = nil
|
26
49
|
end
|
27
50
|
|
28
|
-
|
51
|
+
#
|
52
|
+
# Returns the direct api to the Kynetx Application Manager.
|
53
|
+
#
|
29
54
|
def api
|
30
55
|
@api ||= KynetxAmApi::DirectApi.new({:access_token => @access_token, :access_secret => @access_secret})
|
31
56
|
return @api
|
@@ -34,12 +59,12 @@ module KynetxAmApi
|
|
34
59
|
#
|
35
60
|
# Read applications list
|
36
61
|
#
|
37
|
-
# :offset => Start in list (not implemented)
|
38
|
-
# :size => Number of application to list (not implemented)
|
62
|
+
# - :offset => Start in list (not implemented)
|
63
|
+
# - :size => Number of application to list (not implemented)
|
39
64
|
#
|
40
65
|
# Returns a has with two keys
|
41
|
-
# "apps" => Array Off Hashes with :appid , :role, :name, :created
|
42
|
-
# "valid" => true
|
66
|
+
# - "apps" => Array Off Hashes with :appid , :role, :name, :created
|
67
|
+
# - "valid" => true
|
43
68
|
#
|
44
69
|
def applications(options = {})
|
45
70
|
@applications = api.get_applist if !@applications
|
@@ -47,8 +72,8 @@ module KynetxAmApi
|
|
47
72
|
end
|
48
73
|
|
49
74
|
#
|
50
|
-
# :application_id => application_id
|
51
|
-
# :version => Version of application to obtain
|
75
|
+
# - :application_id => application_id
|
76
|
+
# - :version => Version of application to obtain
|
52
77
|
#
|
53
78
|
def find_application(options = {})
|
54
79
|
options[:version] ||= "development"
|
@@ -75,7 +100,7 @@ module KynetxAmApi
|
|
75
100
|
|
76
101
|
def duplicate_application(application_id)
|
77
102
|
old_app = KynetxAmApi::Application.new(self, application_id)
|
78
|
-
new_app = create_application(old_app.name, "")
|
103
|
+
new_app = create_application(old_app.name || "", "")
|
79
104
|
new_app.krl = old_app.krl
|
80
105
|
return new_app
|
81
106
|
end
|