auth-transis-client 0.0.4 → 0.0.5
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/lib/auth-transis-client.rb +26 -5
- data/lib/auth-transis-client/version.rb +2 -1
- metadata +11 -31
data/lib/auth-transis-client.rb
CHANGED
@@ -16,7 +16,6 @@ module Auth
|
|
16
16
|
|
17
17
|
conn.response :json, :content_type => /\bjson$/
|
18
18
|
|
19
|
-
conn.use :instrumentation
|
20
19
|
conn.adapter Faraday.default_adapter
|
21
20
|
end
|
22
21
|
else
|
@@ -52,15 +51,37 @@ module Auth
|
|
52
51
|
def get_organizations(user_id=nil)
|
53
52
|
options = {}
|
54
53
|
options[:user_id]=user_id if user_id
|
55
|
-
@connection.get(
|
54
|
+
@connection.get("/api/#{API_VERSION}/organizations.json", options).body
|
56
55
|
end
|
57
56
|
|
58
57
|
def get_members_of_organization(organization_id)
|
59
|
-
@connection.get("/api/
|
58
|
+
@connection.get("/api/#{API_VERSION}/organizations/#{organization_id}/members.json").body
|
60
59
|
end
|
61
60
|
|
62
|
-
|
63
|
-
|
61
|
+
##
|
62
|
+
# Creates a user in an organization. If the user already exists in AuthTransis they will
|
63
|
+
# simply be added to the org (assuming the resource owner has rights), if they don't exist
|
64
|
+
# they will be created and added to the organizations.
|
65
|
+
#
|
66
|
+
# Returns a list of the organizations that they were sucessfully added to.
|
67
|
+
def create_user_in_organization(email, organization_id)
|
68
|
+
org_ids = organization_id.respond_to?(:each) ? organization_id : [organization_id]
|
69
|
+
successfuls = []
|
70
|
+
org_ids.each do |org_id|
|
71
|
+
response = @connection.post("/api/#{API_VERSION}/organizations/#{organization_id}/members.json", {:email_address => email})
|
72
|
+
response.success? && successfuls << response.body
|
73
|
+
end
|
74
|
+
successfuls
|
75
|
+
end
|
76
|
+
|
77
|
+
def create_user(email)
|
78
|
+
response = @connection.post("/api/#{API_VERSION}/members.json", {:email_address => email})
|
79
|
+
response.success? && response.body
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_organization(org_name)
|
83
|
+
response = @connection.post("/api/#{API_VERSION}/organizations", {:name => org_name})
|
84
|
+
response.success? && response.body
|
64
85
|
end
|
65
86
|
end
|
66
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth-transis-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70243724662060 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *70243724662060
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: omniauth-oauth2
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70243724661060 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *70243724661060
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: faraday
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70243724660120 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
46
|
+
version_requirements: *70243724660120
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: faraday_middleware
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70243724659080 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
@@ -69,12 +54,7 @@ dependencies:
|
|
69
54
|
version: '0'
|
70
55
|
type: :runtime
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
57
|
+
version_requirements: *70243724659080
|
78
58
|
description: This is the client for TransisApps
|
79
59
|
email:
|
80
60
|
- tim@galeckas.com
|
@@ -112,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
92
|
version: '0'
|
113
93
|
requirements: []
|
114
94
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.8.
|
95
|
+
rubygems_version: 1.8.15
|
116
96
|
signing_key:
|
117
97
|
specification_version: 3
|
118
98
|
summary: See the description
|