Class: Slash3D::Iframe

Inherits:
Object
  • Object
show all
Defined in:
lib/slash3d/iframe.rb

Overview

Represent an Iframe to build a model with 3D Slash

Constant Summary collapse

LANGUAGES =
{
  'en' => 0,
  'fr' => 1
}

Instance Method Summary collapse

Constructor Details

#initialize(content_id: nil, source: nil, redirect_url: nil, lang: nil) ⇒ Iframe



12
13
14
15
16
17
18
19
20
# File 'lib/slash3d/iframe.rb', line 12

def initialize(content_id: nil,
               source: nil,
               redirect_url: nil,
               lang: nil)
  @content_id = content_id
  @source = source
  @redirect_url = redirect_url
  @lang = lang
end

Instance Method Details

#content_idObject



22
23
24
# File 'lib/slash3d/iframe.rb', line 22

def content_id
  @content_id ||= SecureRandom.hex(32)
end

#urlObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/slash3d/iframe.rb', line 26

def url
  parameters = {
    partner: Slash3D.configuration.partner_code,
    content: content_id,
    src: source,
    redirect: redirect_url,
    sign: signature,
    lang: lang_number,
  }

  "https://www.3dslash.net/slash.php?" + parameters.to_query
end