onesky-rails 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efdecfa76c426d6b3c7ba6f9312f98c914f2d2e5
4
- data.tar.gz: 16d9375f705ad4266a060273adf35c724cde0ae9
3
+ metadata.gz: 7310078e5234d06c2c9bf53aeaf4dc69c7460386
4
+ data.tar.gz: 01d3730c16eb8b98cee057605eb73de3c73b2ba5
5
5
  SHA512:
6
- metadata.gz: 4cad9660e157d30d332a0a24b9a934696ef771c4e6a7d15698b37986a458876d4f7d2f22c7c5f93dd10736a201ace9097c4cdaa2c686cc8d0d73e450c6f25765
7
- data.tar.gz: d423d3944b8ddef1b687f9bd7de0ec06e8bdea16ffd445a24c42f7fd237a9e004c474b063a278b9e7a72585aca993e064b00aefd0e17d70b17856cb9b6de27c0
6
+ metadata.gz: 769551ebb66adc4badd7dbe197fa653142719a385d732cc89c4d7dd1afff2dd74a606176d6cf3a8701e55cc787b8f4db16fc11e4f980a6470d8b7730fb3f7e79
7
+ data.tar.gz: 02f599857a3116ef72575bc84c7f54f02ae021e9e1afc0980d5ca5e574d4dd227de2ec141c391c5ac6844ac26425e4db5119707d4cd04bc1eb549d62197fa7d3
@@ -14,3 +14,7 @@
14
14
  * fix download multiple files
15
15
  * able to parse ERB template
16
16
  * able to customize base_locale
17
+
18
+ ### 1.2.0 - 13-JUL-2015
19
+
20
+ * support custom locale
@@ -22,7 +22,7 @@ module Onesky
22
22
  def verify_languages!
23
23
  languages = get_languages_from_onesky!
24
24
  languages.each do |language|
25
- locale = to_rails_locale(language['code'])
25
+ locale = language['custom_locale'] || to_rails_locale(language['code'])
26
26
  if (language['is_base_language'])
27
27
  verify_base_locale!(locale)
28
28
  else
@@ -1,5 +1,5 @@
1
1
  module Onesky
2
2
  module Rails
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -23,9 +23,7 @@ describe Onesky::Rails::Client do
23
23
 
24
24
  context 'success' do
25
25
  before(:each) do
26
- stub_request(:get, full_path_with_auth_hash("/projects/#{config_hash['project_id']}/languages", config_hash['api_key'], config_hash['api_secret']))
27
- .with(headers: {'Content-Type' => 'application/json', 'Onesky-Plugin' => 'rails-string'})
28
- .to_return(status: 200, body: languages_response.to_json)
26
+ stub_project_language_request(languages_response)
29
27
  end
30
28
 
31
29
  it 'to retrieve languages activated at OneSky' do
@@ -45,6 +43,17 @@ describe Onesky::Rails::Client do
45
43
  end
46
44
  end
47
45
 
46
+ context 'success with custom locale' do
47
+ before(:each) do
48
+ stub_project_language_request(custom_locale_response)
49
+ end
50
+
51
+ it 'to use custom locale' do
52
+ expect{client.verify_languages!}.to_not raise_error
53
+ expect(client.onesky_locales).to eq(['es'])
54
+ end
55
+ end
56
+
48
57
  context 'fail' do
49
58
  it 'with incorrect credentials' do
50
59
  stub_request(:get, full_path_with_auth_hash("/projects/#{config_hash['project_id']}/languages", config_hash['api_key'], config_hash['api_secret']))
@@ -47,6 +47,20 @@ def languages_response
47
47
  }
48
48
  end
49
49
 
50
+ def stub_project_language_request(response)
51
+ stub_request(:get, full_path_with_auth_hash("/projects/#{config_hash['project_id']}/languages", config_hash['api_key'], config_hash['api_secret']))
52
+ .with(headers: {'Content-Type' => 'application/json', 'Onesky-Plugin' => 'rails-string'})
53
+ .to_return(status: 200, body: response.to_json)
54
+ end
55
+
56
+ def custom_locale_response
57
+ {data:
58
+ [
59
+ {code: 'es-ES', custom_locale: 'es'},
60
+ ]
61
+ }
62
+ end
63
+
50
64
  def create_config_hash
51
65
  {
52
66
  "api_key" => 'fakeapi',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onesky-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Lam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-09 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 2.2.2
163
+ rubygems_version: 2.4.6
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Rails plugin to sync string files with OneSky