mbsy 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/mbsy.rb +1 -0
- data/lib/mbsy/resources/company.rb +5 -0
- data/lib/mbsy/util/single_sign_on.rb +20 -0
- data/lib/mbsy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 027f6995b316b68d9f2240b2b5084618a1335c1d
|
4
|
+
data.tar.gz: 751840621bb000a4669148a694df9437ccaf9ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8829122f10618fa74a24236ceea6359c08b8c1f4612a9ebe194044b87561dca90c43cf1e764389d9bb02c8a3813d443b6bd98b0d8f34c68e7d1ce49f7d5831c0
|
7
|
+
data.tar.gz: 3124ef8bc77c9a57897ffb4e085dcbe89f192767c5ea4cebd45509ae4e94d39b7e3561bf57b1f9f378170a300578fd66cbcebe2c6e9f5b04cf2aa4fb731f7514
|
data/README.md
CHANGED
@@ -76,6 +76,12 @@ Mbsy::Shortcode.find({ :short_code => YOURCAMPAIGNUID })
|
|
76
76
|
|
77
77
|
# Shortcode in a sandbox campaign
|
78
78
|
Mbsy::Shortcode.find({ :short_code => YOURCAMPAIGNUID, :sandbox => 1 })
|
79
|
+
|
80
|
+
# Generate HTML to embed in your page for single-sign-on
|
81
|
+
Mbsy::SingleSignOn.embed_html(email: current_user.email)
|
82
|
+
|
83
|
+
# and similarly, to logout
|
84
|
+
Mbsy::SingleSignOn.embed_html(email: current_user.email, method: :logout)
|
79
85
|
```
|
80
86
|
|
81
87
|
## Contributing to mbsy
|
data/lib/mbsy.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Mbsy
|
2
|
+
module SingleSignOn
|
3
|
+
|
4
|
+
# produce the <img> tag to embed in your page to implement Single-Sign-On
|
5
|
+
# :email is required and should be the user's email
|
6
|
+
def self.embed_html(o)
|
7
|
+
options = {
|
8
|
+
api_key: Mbsy.api_key,
|
9
|
+
token: Mbsy::Company.token['token'],
|
10
|
+
method: :login
|
11
|
+
}.merge(o)
|
12
|
+
raise ArgumentError, "key :email is required" if options[:email].blank?
|
13
|
+
raise ArgumentError, ":method must be either :login or :logout" unless %w(login logout).include?( options[:method].to_s )
|
14
|
+
signature = Digest::SHA1.hexdigest( options[:api_key] + options[:email] )
|
15
|
+
%Q|<img src="https://#{Mbsy.user_name}.getambassador.com/sso/#{options[:method]}/?token=#{options[:token]}&email=#{URI.escape(options[:email])}&signature=#{signature}" style="border: none; visibility: hidden" alt="" />|
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/mbsy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mbsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Mullen, Chase Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/mbsy/resources/group.rb
|
148
148
|
- lib/mbsy/resources/shortcode.rb
|
149
149
|
- lib/mbsy/resources/social.rb
|
150
|
+
- lib/mbsy/util/single_sign_on.rb
|
150
151
|
- lib/mbsy/version.rb
|
151
152
|
- mbsy.gemspec
|
152
153
|
- spec/mbsy_spec.rb
|