Module: ProoflinkConnect

Defined in:
lib/prooflink_connect.rb,
lib/prooflink_connect/share.rb,
lib/prooflink_connect/version.rb,
lib/prooflink_connect/activity.rb,
lib/prooflink_connect/assertion.rb,
lib/prooflink_connect/share_button.rb,
lib/prooflink_connect/configuration.rb,
lib/prooflink_connect/portable_contacts.rb

Defined Under Namespace

Modules: PortableContacts Classes: Activity, Assertion, Configuration, Invite, Share, ShareButton

Constant Summary collapse

VERSION =
"0.0.24"

Class Method Summary collapse

Class Method Details

.configObject



12
13
14
# File 'lib/prooflink_connect.rb', line 12

def self.config
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



16
17
18
# File 'lib/prooflink_connect.rb', line 16

def self.configure
  yield config
end

.embedded(options = {}, config = ProoflinkConnect.config) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/prooflink_connect.rb', line 20

def self.embedded(options = {}, config = ProoflinkConnect.config)
  # needed because you didn't have to use px explicitly in the old situation
  [:width, :height].each do |dimension|
    next if options[dimension].nil?
    value = options[dimension].to_s
    if !value.match(/[%|px]/)
      options[dimension] = value << "px"
    end
  end

  options = {
    :subdomain => config.subdomain,
    :token_url => 'https://example.com/auth/callbacks',
    :forced_connect => false,
    :embed_forms => false, # will be deprecated
    :split_screen => false,
    :use_popups => true,
    :register_flow => false,
    :width => '520px',
    :height => '250px'}.merge(options)

  domain_part = [options[:subdomain], config.provider_endpoint].compact.join(".")
  path_part = [options[:locale], 'authentications', 'embedded'].compact.join("/")
  query_part = "token_url=#{options[:token_url]}"
  query_part << "&forced_connect=1" if options[:forced_connect]
  query_part << "&embed_forms=1" if options[:embed_forms]
  query_part << "&split_screen=1" if options[:split_screen]
  query_part << "&use_popups=1" if options[:use_popups]
  query_part << "&show_header=#{options[:show_header] ? 1 : 0}" if !options[:show_header].nil?
  query_part << "&register_flow=1" if options[:register_flow]
  query_part << "&scenario=#{options[:scenario]}" if options[:scenario]
  frame_url = "#{config.protocol}://#{domain_part}/#{path_part}?#{query_part}"
  html = "<iframe src='#{frame_url}' style='width: #{options[:width]}; height: #{options[:height]}; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
  html.respond_to?(:html_safe) ? html.html_safe : html
end

.track_activity(identifier, user, options = {}) ⇒ Object



56
57
58
# File 'lib/prooflink_connect.rb', line 56

def self.track_activity(identifier, user, options = {})
  Activity.track(identifier, user, options)
end