slash3d 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/slash3d/iframe.rb +14 -2
- data/lib/slash3d/version.rb +1 -1
- data/spec/iframe_spec.rb +11 -0
- 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: f9a394b3ae561ac8bd4e66f40ed3e6021bacec70
|
4
|
+
data.tar.gz: b283b5c24d70f8be888798cb07410b94408b7699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90248ee01cbdad997af0baef05bfbcf4b1ba13894a6849f0e2fc57e5955c5647b84dbfb8a17f02c6b82b627c12b9e641099c5bdaeb4e69b35e1959fbdbb45930
|
7
|
+
data.tar.gz: dc582b2ee641645f8c81555ed23e5923ded547bdca4e117777eb4f776da95eecb5bcc44e8744b48d788f77920d6e8aeb517de8879e646b7b218fc4ae10711bc6
|
data/README.md
CHANGED
data/lib/slash3d/iframe.rb
CHANGED
@@ -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
|
data/lib/slash3d/version.rb
CHANGED
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.
|
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-
|
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:
|