slash3d 0.0.1 → 0.0.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: f293a2b373781f1bab3fbb20331a0cead2fb13de
4
- data.tar.gz: 561d431cebe0cbfd8e6d652a7670378f90dd94e2
3
+ metadata.gz: f9a394b3ae561ac8bd4e66f40ed3e6021bacec70
4
+ data.tar.gz: b283b5c24d70f8be888798cb07410b94408b7699
5
5
  SHA512:
6
- metadata.gz: 2b1f797a59959d09aa7412146c8c81419d7da22f19ca151bca9a03e430b9153182ae34df0c87229b69fd58eb6fae878cde4c7034951c8e215fa90245ce5863b8
7
- data.tar.gz: 7c5162c6bb6f06b4e6e9aae9506c819880cb751c6e63d57f3cb1f633d5ee49a360fcbfb85e1057917a9a3bb19041eacbef798228e35169518fbd1e66569999c5
6
+ metadata.gz: 90248ee01cbdad997af0baef05bfbcf4b1ba13894a6849f0e2fc57e5955c5647b84dbfb8a17f02c6b82b627c12b9e641099c5bdaeb4e69b35e1959fbdbb45930
7
+ data.tar.gz: dc582b2ee641645f8c81555ed23e5923ded547bdca4e117777eb4f776da95eecb5bcc44e8744b48d788f77920d6e8aeb517de8879e646b7b218fc4ae10711bc6
data/README.md CHANGED
@@ -45,6 +45,7 @@ Usage
45
45
  iframe = Slash3D::Iframe.new(
46
46
  source: <url of stl or 3d slash id>,
47
47
  redirect_url: <your url>,
48
+ lang: 'en',
48
49
  )
49
50
 
50
51
  iframe.url #=> "https://www.3dslash.net/slash.php?…"
@@ -4,12 +4,19 @@ require "securerandom"
4
4
  module Slash3D
5
5
  # Represent an Iframe to build a model with 3D Slash
6
6
  class Iframe
7
+ LANGUAGES = {
8
+ 'en' => 0,
9
+ 'fr' => 1
10
+ }
11
+
7
12
  def initialize(content_id: nil,
8
13
  source: nil,
9
- redirect_url: nil)
14
+ redirect_url: nil,
15
+ lang: nil)
10
16
  @content_id = content_id
11
17
  @source = source
12
18
  @redirect_url = redirect_url
19
+ @lang = lang
13
20
  end
14
21
 
15
22
  def content_id
@@ -23,6 +30,7 @@ module Slash3D
23
30
  src: source,
24
31
  redirect: redirect_url,
25
32
  sign: signature,
33
+ lang: lang_number,
26
34
  }
27
35
 
28
36
  "https://www.3dslash.net/slash.php?" + parameters.to_query
@@ -30,6 +38,10 @@ module Slash3D
30
38
 
31
39
  private
32
40
 
41
+ def lang_number
42
+ LANGUAGES.fetch(lang || 'en')
43
+ end
44
+
33
45
  def signature
34
46
  signature_values = [
35
47
  Slash3D.configuration.api_key,
@@ -42,6 +54,6 @@ module Slash3D
42
54
  Digest::SHA256.hexdigest(signature_values.join("|"))
43
55
  end
44
56
 
45
- attr_reader :source, :redirect_url
57
+ attr_reader :source, :redirect_url, :lang
46
58
  end
47
59
  end
@@ -1,3 +1,3 @@
1
1
  module Slash3D
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/iframe_spec.rb CHANGED
@@ -15,6 +15,7 @@ module Slash3D
15
15
  it "returns a full url to 3dslash" do
16
16
  url = "https://www.3dslash.net/slash.php" \
17
17
  "?content=c97ff01cdf0fca07a33dce9" \
18
+ "&lang=0" \
18
19
  "&partner=test_partner_code" \
19
20
  "&redirect=http%3A%2F%2Fredirect-url" \
20
21
  "&sign=4c5fd2b2aa423d430f22ba940f4e28f7060fc39b2e44a70e656f74b94a38859c" \
@@ -22,6 +23,16 @@ module Slash3D
22
23
 
23
24
  expect(iframe.url).to eq(url)
24
25
  end
26
+
27
+ context 'when given the "fr" lang' do
28
+ let(:options) { { source: "http://source-url",
29
+ redirect_url: "http://redirect-url",
30
+ lang: "fr" } }
31
+
32
+ it "contains the language number" do
33
+ expect(iframe.url).to match(/&lang=1&/)
34
+ end
35
+ end
25
36
  end
26
37
 
27
38
  describe "#content_id" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slash3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunny Ripert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -129,3 +129,4 @@ test_files:
129
129
  - spec/iframe_spec.rb
130
130
  - spec/response_spec.rb
131
131
  - spec/spec_helper.rb
132
+ has_rdoc: