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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d92d3523d8653d955fffba060a1206ce210621d
4
- data.tar.gz: 3928d6606de957c6ed1a8ba059baece8bdf2c366
3
+ metadata.gz: 027f6995b316b68d9f2240b2b5084618a1335c1d
4
+ data.tar.gz: 751840621bb000a4669148a694df9437ccaf9ec0
5
5
  SHA512:
6
- metadata.gz: fe9b2c1b53f83cf6d3c54ddf1e18b29be59b793bd584d1a4f588ac3f6f94d9fce07bf28df5dbd9c27c2d4cc54e1da9aeebba213495f3ecc95d5676a7627ce545
7
- data.tar.gz: 71b1d62bd652f1da13ab84bdea8b3fa651ba32749b5332af70e35314e0ecd33319c55e56c21c5a2757bc98d5d7fb069622cf0cd38473ab9060e6c8a0c167648d
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
@@ -9,6 +9,7 @@ require 'mbsy/resources/event'
9
9
  require 'mbsy/resources/group'
10
10
  require 'mbsy/resources/shortcode'
11
11
  require 'mbsy/resources/social'
12
+ require 'mbsy/util/single_sign_on'
12
13
 
13
14
  module Mbsy
14
15
  class << self
@@ -7,5 +7,10 @@ module Mbsy
7
7
  def self.stats
8
8
  call('stats')
9
9
  end
10
+
11
+ def self.token
12
+ call('token')
13
+ end
14
+
10
15
  end
11
16
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Mbsy
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
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.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-05-27 00:00:00.000000000 Z
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