yatapp 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/yatapp.rb +17 -4
- data/lib/yatapp/version.rb +1 -1
- data/lib/yatapp/yata_api_caller.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a7bf95b877edeb026730611072147b15ed2df13
|
4
|
+
data.tar.gz: 03cc7a74ece3a6ab0c6cd609ac241b08afcd5dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22010be3d955b7da504bb3d449c8180ba6ed419fd18c80cb8f6d3ba342ceb9520102d2262bb647bb45f433443c90c3beef66ea952f304152e88e84641a77311b
|
7
|
+
data.tar.gz: 16d814a2e083984de830f165970027106f9d0b37e1321a5c2934d396525495f7e67ec25945ba18416d812398e5e089e4127b6ef2a8e9c29a00b8d4a9f5edc9b6
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ end
|
|
35
35
|
yata_project do
|
36
36
|
project_id 'your-project-id' # project id you wish to fetch from (you can find it under settings of your organization)
|
37
37
|
languages ['en', 'de'] # add any languages you wish by language code
|
38
|
-
format :json # format you wish to get files in, available for now are (yaml and json)
|
38
|
+
format :json # format you wish to get files in, available for now are (yaml, js and json)
|
39
39
|
end
|
40
40
|
|
41
41
|
```
|
data/lib/yatapp.rb
CHANGED
@@ -15,27 +15,40 @@ module Yatapp
|
|
15
15
|
def api_caller
|
16
16
|
@api_caller ||= YataApiCaller.new
|
17
17
|
end
|
18
|
+
|
19
|
+
def all_projects
|
20
|
+
@all_projects ||= []
|
21
|
+
end
|
22
|
+
|
23
|
+
def all_projects_add(project)
|
24
|
+
@all_projects ||= []
|
25
|
+
@all_projects << project
|
26
|
+
end
|
18
27
|
end
|
19
28
|
|
20
29
|
module Methods
|
21
30
|
def yata_project
|
31
|
+
@current_project = YataApiCaller.new
|
22
32
|
yield
|
33
|
+
Yatapp.all_projects_add(@current_project)
|
34
|
+
puts "DEBUG: #{Yatapp.all_projects.inspect}"
|
23
35
|
end
|
24
36
|
|
25
37
|
def languages(languages)
|
26
|
-
|
38
|
+
@current_project.set_languages(languages)
|
39
|
+
puts "current_project is: #{@current_project.inspect}"
|
27
40
|
end
|
28
41
|
|
29
42
|
def project_id(project_id)
|
30
|
-
|
43
|
+
@current_project.set_project_id(project_id)
|
31
44
|
end
|
32
45
|
|
33
46
|
def translations_format(frmt)
|
34
|
-
|
47
|
+
@current_project.set_translation_format(frmt)
|
35
48
|
end
|
36
49
|
|
37
50
|
def get_translations
|
38
|
-
Yatapp.
|
51
|
+
Yatapp.all_projects.map { |p| p.get_translations }
|
39
52
|
end
|
40
53
|
end
|
41
54
|
end
|
data/lib/yatapp/version.rb
CHANGED
@@ -22,7 +22,7 @@ module Yatapp
|
|
22
22
|
def initialize
|
23
23
|
initialize_configuration
|
24
24
|
@translation_format = 'json'
|
25
|
-
@connection =
|
25
|
+
@connection = prepare_connection
|
26
26
|
end
|
27
27
|
|
28
28
|
def set_languages(languages)
|
@@ -53,6 +53,7 @@ module Yatapp
|
|
53
53
|
puts "INVALID RESPONSE: #{api_response.body}"
|
54
54
|
return false
|
55
55
|
end
|
56
|
+
return true
|
56
57
|
end
|
57
58
|
|
58
59
|
def initialize_configuration
|
@@ -62,13 +63,14 @@ module Yatapp
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
65
|
-
def
|
66
|
+
def prepare_connection
|
66
67
|
Faraday.new(url: API_BASE_URL) do |faraday|
|
67
68
|
faraday.adapter :typhoeus
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
72
|
def save_translation(lang, response)
|
73
|
+
puts "save_translation #{lang} #{response.inspect}"
|
72
74
|
bfp = base_file_path
|
73
75
|
File.open("#{bfp}#{lang}.yata.#{translation_format}", 'wb') { |f| f.write(response.body) }
|
74
76
|
puts "#{lang}.yata.#{translation_format} saved"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yatapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- luki3k5
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|