smartling_api 0.3.0 → 0.4.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.buildkite/pipeline.yaml +6 -0
- data/.github/CODEOWNERS +1 -0
- data/.gitignore +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +12 -0
- data/Gemfile.lock +75 -0
- data/README.md +5 -6
- data/lib/smartling_api/clients/smartling.rb +4 -3
- data/lib/smartling_api/errors/raise_error.rb +1 -2
- data/lib/smartling_api/file.rb +9 -6
- data/lib/smartling_api/version.rb +1 -1
- data/smartling_api.gemspec +17 -17
- metadata +21 -91
- data/.travis.yml +0 -5
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3e4adb93edca4bbdeaca56ecdf6d8e2a5cb53596f7df8b9e47c0da196ba75917
|
4
|
+
data.tar.gz: e1ccc0348b8699432d67bcc5a04a7b21797eeaf079023576ef0a8a331c7d8ee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777aa405239ebc273d161a5a2385c0162c3a7c06fc6b842e85654a09efed64736755ab8b7435b6781a23181218842825a312c7fc0e7304cf85c2a84360380080
|
7
|
+
data.tar.gz: 00f0ab77725201897c61e9102f1eab88e240aed172e783793edaa56af36b81bf891bc2064fe4163482b415dad454baf60926afa80e56841309b71d9331a229fb
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @redbubble/core
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2
|
1
|
+
3.2.2
|
data/Gemfile
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in smartling_api.gemspec
|
4
6
|
gemspec
|
7
|
+
|
8
|
+
# Dev dependencies:
|
9
|
+
group :development do
|
10
|
+
gem "bundler", "~> 2.4"
|
11
|
+
gem "pry", "~> 0.14.2"
|
12
|
+
gem "rake", "~> 13.1"
|
13
|
+
gem "rspec", "~> 3.12"
|
14
|
+
gem "simplecov", require: false
|
15
|
+
gem "webmock", "~> 3.19"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
smartling_api (0.4.0.pre.1)
|
5
|
+
faraday (~> 2.7)
|
6
|
+
faraday-multipart (~> 1.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.8.5)
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
13
|
+
base64 (0.2.0)
|
14
|
+
coderay (1.1.3)
|
15
|
+
crack (0.4.5)
|
16
|
+
rexml
|
17
|
+
diff-lcs (1.5.0)
|
18
|
+
docile (1.4.0)
|
19
|
+
faraday (2.7.12)
|
20
|
+
base64
|
21
|
+
faraday-net_http (>= 2.0, < 3.1)
|
22
|
+
ruby2_keywords (>= 0.0.4)
|
23
|
+
faraday-multipart (1.0.4)
|
24
|
+
multipart-post (~> 2)
|
25
|
+
faraday-net_http (3.0.2)
|
26
|
+
hashdiff (1.0.1)
|
27
|
+
method_source (1.0.0)
|
28
|
+
multipart-post (2.3.0)
|
29
|
+
pry (0.14.2)
|
30
|
+
coderay (~> 1.1)
|
31
|
+
method_source (~> 1.0)
|
32
|
+
public_suffix (5.0.4)
|
33
|
+
rake (13.1.0)
|
34
|
+
rexml (3.2.6)
|
35
|
+
rspec (3.12.0)
|
36
|
+
rspec-core (~> 3.12.0)
|
37
|
+
rspec-expectations (~> 3.12.0)
|
38
|
+
rspec-mocks (~> 3.12.0)
|
39
|
+
rspec-core (3.12.2)
|
40
|
+
rspec-support (~> 3.12.0)
|
41
|
+
rspec-expectations (3.12.3)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-mocks (3.12.6)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-support (3.12.1)
|
48
|
+
ruby2_keywords (0.0.5)
|
49
|
+
simplecov (0.22.0)
|
50
|
+
docile (~> 1.1)
|
51
|
+
simplecov-html (~> 0.11)
|
52
|
+
simplecov_json_formatter (~> 0.1)
|
53
|
+
simplecov-html (0.12.3)
|
54
|
+
simplecov_json_formatter (0.1.4)
|
55
|
+
webmock (3.19.1)
|
56
|
+
addressable (>= 2.8.0)
|
57
|
+
crack (>= 0.3.2)
|
58
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
aarch64-linux
|
62
|
+
arm64-darwin-22
|
63
|
+
x86_64-linux
|
64
|
+
|
65
|
+
DEPENDENCIES
|
66
|
+
bundler (~> 2.4)
|
67
|
+
pry (~> 0.14.2)
|
68
|
+
rake (~> 13.1)
|
69
|
+
rspec (~> 3.12)
|
70
|
+
simplecov
|
71
|
+
smartling_api!
|
72
|
+
webmock (~> 3.19)
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
2.4.10
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
Smartling Api
|
2
2
|
=============
|
3
3
|
|
4
|
-
![Build Status](https://travis-ci.org/redbubble/smartling_api.svg?branch=master)
|
5
4
|
[![Code Climate](https://codeclimate.com/github/redbubble/smartling_api/badges/gpa.svg)](https://codeclimate.com/github/redbubble/smartling_api)
|
6
5
|
[![Gem Version](https://badge.fury.io/rb/smartling_api.svg)](https://badge.fury.io/rb/smartling_api)
|
7
6
|
![Docs](https://inch-ci.org/github/redbubble/smartling_api.svg?branch=master)
|
@@ -11,7 +10,7 @@ Overview
|
|
11
10
|
|
12
11
|
Ruby wrapper for accessing the Smartling Translation API V2.
|
13
12
|
|
14
|
-
The Smartling Translation API lets developers
|
13
|
+
The Smartling Translation API lets developers internationalize their website or app by automating the translation and integration of their site content. Developers can upload resource files and download the translated files in a language of their choosing. There are options to allow for professional translation, community translation and machine translation.
|
15
14
|
|
16
15
|
[Smartling API V2](http://docs.smartling.com/pages/API/v2/)
|
17
16
|
|
@@ -27,12 +26,12 @@ Installation
|
|
27
26
|
|
28
27
|
Add this line to your application's Gemfile:
|
29
28
|
|
30
|
-
gem 'smartling_api', '0.
|
31
|
-
|
29
|
+
gem 'smartling_api', '~> 0.4.0'
|
30
|
+
|
32
31
|
### Run Tests
|
33
32
|
|
34
33
|
bundle exec rspec
|
35
|
-
|
34
|
+
|
36
35
|
|
37
36
|
Usage
|
38
37
|
-----
|
@@ -51,7 +50,7 @@ You can obtain an id, secret via [Create Authentication Tokens](http://docs.smar
|
|
51
50
|
|
52
51
|
The `project_id` is optional. If you are only using a single `project_id` per application then you may add your `project_id` here. If not you will have to pass the `project_id` when you create your api call. Examples below.
|
53
52
|
|
54
|
-
###
|
53
|
+
### API Reference
|
55
54
|
|
56
55
|
Reference documentation on accessing the smartling api can be found on: [Api documentation](./doc/api.md)
|
57
56
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'faraday'
|
2
|
-
require 'faraday_middleware'
|
3
2
|
require 'smartling_api/errors/raise_error'
|
4
3
|
|
5
4
|
module SmartlingApi
|
@@ -83,8 +82,9 @@ module SmartlingApi
|
|
83
82
|
|
84
83
|
faraday.response :json, content_type: /\bjson$/
|
85
84
|
|
86
|
-
faraday.adapter :net_http
|
87
85
|
faraday.use Errors::RaiseError
|
86
|
+
|
87
|
+
faraday.adapter Faraday.default_adapter
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -95,8 +95,9 @@ module SmartlingApi
|
|
95
95
|
|
96
96
|
faraday.response :json, content_type: /\bjson$/
|
97
97
|
|
98
|
-
faraday.adapter :net_http
|
99
98
|
faraday.use Errors::RaiseError
|
99
|
+
|
100
|
+
faraday.adapter Faraday.default_adapter
|
100
101
|
end
|
101
102
|
end
|
102
103
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'faraday'
|
2
|
-
require 'faraday_middleware'
|
3
2
|
require 'smartling_api/errors/not_found'
|
4
3
|
require 'smartling_api/errors/client'
|
5
4
|
require 'smartling_api/errors/internal_server'
|
@@ -8,7 +7,7 @@ require 'smartling_api/errors/unprocessable_entity'
|
|
8
7
|
module SmartlingApi
|
9
8
|
module Errors
|
10
9
|
# Middleware for Faraday error handling
|
11
|
-
class RaiseError < Faraday::
|
10
|
+
class RaiseError < Faraday::Middleware
|
12
11
|
# Mapping of Smartling Error response
|
13
12
|
ERRORS = {
|
14
13
|
404 => NotFound,
|
data/lib/smartling_api/file.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
4
|
+
require 'faraday/multipart'
|
2
5
|
require 'smartling_api/clients/smartling'
|
3
6
|
require 'smartling_api/authentication'
|
4
7
|
|
@@ -56,9 +59,9 @@ module SmartlingApi
|
|
56
59
|
# @return [Hash] Details of upload
|
57
60
|
def upload(file_path:, file_uri:, file_type:, **options)
|
58
61
|
body = {
|
59
|
-
file:
|
60
|
-
fileUri:
|
61
|
-
fileType: file_type
|
62
|
+
file: Faraday::UploadIO.new(file_path, 'text/plain'),
|
63
|
+
fileUri: file_uri,
|
64
|
+
fileType: file_type,
|
62
65
|
}.merge(options)
|
63
66
|
|
64
67
|
smartling.upload(url: "/files-api/v2/projects/#{project_id}/file", token: token, body: body)
|
@@ -91,14 +94,14 @@ module SmartlingApi
|
|
91
94
|
# @return [Hash] Details of tranlsations
|
92
95
|
def get_translations(file_path:, file_uri:, locale_id:, **options)
|
93
96
|
body = {
|
94
|
-
file:
|
95
|
-
fileUri:
|
97
|
+
file: Faraday::UploadIO.new(file_path, 'text/plain'),
|
98
|
+
fileUri: file_uri,
|
96
99
|
}.merge(options)
|
97
100
|
|
98
101
|
smartling.upload(url: "/files-api/v2/projects/#{project_id}/locales/#{locale_id}/file/get-translations", token: token, body: body)
|
99
102
|
end
|
100
103
|
|
101
|
-
|
104
|
+
private
|
102
105
|
|
103
106
|
attr_reader :smartling, :token, :project_id
|
104
107
|
|
data/smartling_api.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'smartling_api/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'smartling_api'
|
8
9
|
spec.version = SmartlingApi::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Redbubble']
|
11
|
+
spec.email = ['developers@redbubble.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.summary = 'THIS GEM IS EXTREMELY DEPRECATED - DO NOT USE'
|
14
|
+
spec.homepage = 'https://github.com/redbubble/smartling_api'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
18
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.required_ruby_version = '>= 2.7.8'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'faraday', '~> 2.7'
|
25
|
+
spec.add_runtime_dependency 'faraday-multipart', '~> 1.0'
|
20
26
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.4"
|
24
|
-
spec.add_development_dependency "webmock", "~> 2.1"
|
25
|
-
spec.add_development_dependency "pry", "~> 0.10"
|
26
|
-
spec.add_runtime_dependency "faraday", "~> 0.9"
|
27
|
-
spec.add_runtime_dependency "faraday_middleware", "~> 0.9"
|
27
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,128 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartling_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redbubble
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.11'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.4'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.4'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: webmock
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.1'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.1'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.10'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.10'
|
83
13
|
- !ruby/object:Gem::Dependency
|
84
14
|
name: faraday
|
85
15
|
requirement: !ruby/object:Gem::Requirement
|
86
16
|
requirements:
|
87
17
|
- - "~>"
|
88
18
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
19
|
+
version: '2.7'
|
90
20
|
type: :runtime
|
91
21
|
prerelease: false
|
92
22
|
version_requirements: !ruby/object:Gem::Requirement
|
93
23
|
requirements:
|
94
24
|
- - "~>"
|
95
25
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
26
|
+
version: '2.7'
|
97
27
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
28
|
+
name: faraday-multipart
|
99
29
|
requirement: !ruby/object:Gem::Requirement
|
100
30
|
requirements:
|
101
31
|
- - "~>"
|
102
32
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
33
|
+
version: '1.0'
|
104
34
|
type: :runtime
|
105
35
|
prerelease: false
|
106
36
|
version_requirements: !ruby/object:Gem::Requirement
|
107
37
|
requirements:
|
108
38
|
- - "~>"
|
109
39
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
111
|
-
description:
|
40
|
+
version: '1.0'
|
41
|
+
description:
|
112
42
|
email:
|
113
43
|
- developers@redbubble.com
|
114
44
|
executables: []
|
115
45
|
extensions: []
|
116
46
|
extra_rdoc_files: []
|
117
47
|
files:
|
48
|
+
- ".buildkite/pipeline.yaml"
|
49
|
+
- ".github/CODEOWNERS"
|
118
50
|
- ".gitignore"
|
119
51
|
- ".ruby-version"
|
120
|
-
- ".travis.yml"
|
121
52
|
- Gemfile
|
53
|
+
- Gemfile.lock
|
122
54
|
- LICENCE.txt
|
123
55
|
- README.md
|
124
|
-
- bin/console
|
125
|
-
- bin/setup
|
126
56
|
- doc/api.md
|
127
57
|
- doc/redbubble.png
|
128
58
|
- lib/smartling_api.rb
|
@@ -142,8 +72,9 @@ files:
|
|
142
72
|
homepage: https://github.com/redbubble/smartling_api
|
143
73
|
licenses:
|
144
74
|
- MIT
|
145
|
-
metadata:
|
146
|
-
|
75
|
+
metadata:
|
76
|
+
rubygems_mfa_required: 'true'
|
77
|
+
post_install_message:
|
147
78
|
rdoc_options: []
|
148
79
|
require_paths:
|
149
80
|
- lib
|
@@ -151,16 +82,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
82
|
requirements:
|
152
83
|
- - ">="
|
153
84
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
85
|
+
version: 2.7.8
|
155
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
87
|
requirements:
|
157
|
-
- - "
|
88
|
+
- - ">"
|
158
89
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
90
|
+
version: 1.3.1
|
160
91
|
requirements: []
|
161
|
-
|
162
|
-
|
163
|
-
signing_key:
|
92
|
+
rubygems_version: 3.4.10
|
93
|
+
signing_key:
|
164
94
|
specification_version: 4
|
165
|
-
summary:
|
95
|
+
summary: THIS GEM IS EXTREMELY DEPRECATED - DO NOT USE
|
166
96
|
test_files: []
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "smartling_api"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|