phraseapp-ruby 1.0.13 → 1.0.15

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: 3039ead9df5cb430b9e3724285138a4bcdd624da
4
- data.tar.gz: 6ed573a0c34f80284767bd48e8538d2ef46fd7db
3
+ metadata.gz: 058fa89f6b08b1b9f37315377a737c157c21aa9d
4
+ data.tar.gz: 581635c7ad2d5db9c137d00f8cb38f78cc93b3ae
5
5
  SHA512:
6
- metadata.gz: 247c94438e6033536ff3ce5fa2fca0c8612351949d79936ae6520cf132ad715a848b7bcb9a7796048cd085c49ebd78e0f03be8c9e628bae1f1521f94e559d94c
7
- data.tar.gz: 0015673bb21c0ecc18be90aec3b8b1422dc2ff312289b8bdc3e76ea1e4491d374b28a786162ac75681cfc6fc3c1eae3a7416e499e5044d175de26098f995b44d
6
+ metadata.gz: fe0998dba3662539a79f255d4d5f666bafc58152fa980696dd3bd892b04f6a51959fdc90b3e58c7505fab088e99e25196dc5c24d26fa54243cd188bb8590b714
7
+ data.tar.gz: 18020bf020462151be285f453a3b911827be2254489bf6f493c639ed980738f6cb1b512a1f739a57936bcafe0dfdb3a1f51704e48808bdea874132a4adfe9441
@@ -4,6 +4,7 @@ module PhraseApp
4
4
 
5
5
  module Auth
6
6
 
7
+ # See PhraseApp::Client for usage example
7
8
  class AuthHandler < OpenStruct
8
9
  def validate
9
10
  if self.username == "" && self.token == ""
@@ -13,6 +14,7 @@ module PhraseApp
13
14
  end
14
15
  end
15
16
 
17
+ private
16
18
  def load_config
17
19
  path = self.config
18
20
  tmpA = AuthHandler.new
@@ -36,10 +38,14 @@ module PhraseApp
36
38
  self.tfa = tmpA.tfa
37
39
  end
38
40
 
39
- if tmpA.host && self.username.nil?
41
+ if tmpA.host
40
42
  self.host = tmpA.host
41
43
  end
42
44
 
45
+ if tmpA.debug
46
+ self.debug = tmpA.debug
47
+ end
48
+
43
49
  return nil
44
50
  end
45
51
  end
@@ -60,6 +66,14 @@ module PhraseApp
60
66
  end
61
67
  end
62
68
 
69
+ def self.debug
70
+ if authH.debug && authH.debug != ""
71
+ return authH.debug
72
+ else
73
+ return false
74
+ end
75
+ end
76
+
63
77
  def self.authenticate(req)
64
78
  if authH == nil
65
79
  raise("no auth handler registered")
@@ -1026,7 +1026,7 @@ module RequestParams
1026
1026
  # locale_id::
1027
1027
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
1028
1028
  # q::
1029
- # Filter the results. Supports text queries for key name with 'name:key_name' and qualifiers like translated/untranslated 'translated:true/false'. Requires an additional <code>locale_id</code> parameter if 'translated:true/false' is used.
1029
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1030
1030
  class KeysDeleteParams < ::OpenStruct
1031
1031
  def locale_id=(val)
1032
1032
  self.locale_id = val
@@ -1051,7 +1051,7 @@ module RequestParams
1051
1051
  # order::
1052
1052
  # Order direction. Can be one of: asc, desc.
1053
1053
  # q::
1054
- # Specify a <a href="/guides/working-with-phraseapp/search-terms">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status*</li> <li><code>updated_at{>=|<=}21-02-2013</code> for date range queries</li> </ul> *Also requires <code>locale_id</code> to be specified.
1054
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1055
1055
  # sort::
1056
1056
  # Sort by field. Can be one of: name, created_at, updated_at.
1057
1057
  class KeysListParams < ::OpenStruct
@@ -1086,7 +1086,7 @@ module RequestParams
1086
1086
  # order::
1087
1087
  # Order direction. Can be one of: asc, desc.
1088
1088
  # q::
1089
- # Filter the results. Supports text queries for name:key_name and qualifiers translated:true/false as well as date range queries. Requires an additional <code>locale_id</code> parameter if 'translated:true/false' is used.
1089
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1090
1090
  # sort::
1091
1091
  # Sort by field. Can be one of: name, created_at, updated_at.
1092
1092
  class KeysSearchParams < ::OpenStruct
@@ -1119,7 +1119,7 @@ module RequestParams
1119
1119
  # locale_id::
1120
1120
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
1121
1121
  # q::
1122
- # Filter the results. Supports text queries for key name with 'name:key_name' and qualifiers like translated/untranslated 'translated:true/false'. Requires an additional <code>locale_id</code> parameter if 'translated:true/false' is used.
1122
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1123
1123
  # tags::
1124
1124
  # Tag or comma-separated list of tags to add to the matching collection of keys
1125
1125
  class KeysTagParams < ::OpenStruct
@@ -1150,7 +1150,7 @@ module RequestParams
1150
1150
  # locale_id::
1151
1151
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
1152
1152
  # q::
1153
- # Filter the results. Supports text queries for key name with 'name:key_name' and qualifiers like translated/untranslated 'translated:true/false'. Requires an additional <code>locale_id</code> parameter if 'translated:true/false' is used.
1153
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1154
1154
  # tags::
1155
1155
  # Tag or comma-separated list of tags to add to the matching collection of keys
1156
1156
  class KeysUntagParams < ::OpenStruct
@@ -1188,8 +1188,8 @@ module RequestParams
1188
1188
  # Indicates whether keys without translations should be included in the output as well.
1189
1189
  # keep_notranslate_tags::
1190
1190
  # Indicates whether [NOTRANSLATE] tags should be kept.
1191
- # tag_id::
1192
- # Limit result to keys tagged with the given tag (identified by its id).
1191
+ # tag::
1192
+ # Limit result to keys tagged with the given tag (identified by its name).
1193
1193
  class LocaleDownloadParams < ::OpenStruct
1194
1194
  def convert_emoji=(val)
1195
1195
  if val == "true"
@@ -1229,8 +1229,8 @@ module RequestParams
1229
1229
  end
1230
1230
  end
1231
1231
 
1232
- def tag_id=(val)
1233
- self.tag_id = val
1232
+ def tag=(val)
1233
+ self.tag = val
1234
1234
  end
1235
1235
 
1236
1236
  def validate
@@ -1297,7 +1297,7 @@ module RequestParams
1297
1297
  # order::
1298
1298
  # Order direction. Can be one of: asc, desc.
1299
1299
  # q::
1300
- # Filter the results. Supports text queries with the same results as in the Translation Center as well as qualifiers like unverified:true/false and date range queries.
1300
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1301
1301
  # sort::
1302
1302
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1303
1303
  class TranslationsByKeyParams < ::OpenStruct
@@ -1326,7 +1326,7 @@ module RequestParams
1326
1326
  # order::
1327
1327
  # Order direction. Can be one of: asc, desc.
1328
1328
  # q::
1329
- # Filter the results. Supports text queries with the same results as in the Translation Center as well as qualifiers like unverified:true/false and date range queries.
1329
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1330
1330
  # sort::
1331
1331
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1332
1332
  class TranslationsByLocaleParams < ::OpenStruct
@@ -1355,7 +1355,7 @@ module RequestParams
1355
1355
  # order::
1356
1356
  # Order direction. Can be one of: asc, desc.
1357
1357
  # q::
1358
- # Filter the results. Supports text queries with same results as in Translation Center and qualifiers such as unverified:true/false as well as date range queries.
1358
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1359
1359
  # sort::
1360
1360
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1361
1361
  class TranslationsExcludeParams < ::OpenStruct
@@ -1384,7 +1384,7 @@ module RequestParams
1384
1384
  # order::
1385
1385
  # Order direction. Can be one of: asc, desc.
1386
1386
  # q::
1387
- # Filter the results. Supports text queries with same results as in Translation Center and qualifiers such as unverified:true/false as well as date range queries.
1387
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1388
1388
  # sort::
1389
1389
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1390
1390
  class TranslationsIncludeParams < ::OpenStruct
@@ -1413,7 +1413,7 @@ module RequestParams
1413
1413
  # order::
1414
1414
  # Order direction. Can be one of: asc, desc.
1415
1415
  # q::
1416
- # Filter the results. Supports text queries with the same results as in the Translation Center as well as qualifiers like unverified:true/false and date range queries.
1416
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1417
1417
  # sort::
1418
1418
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1419
1419
  class TranslationsListParams < ::OpenStruct
@@ -1442,7 +1442,7 @@ module RequestParams
1442
1442
  # order::
1443
1443
  # Order direction. Can be one of: asc, desc.
1444
1444
  # q::
1445
- # Filter the results. Supports text queries with the same results as in the Translation Center as well as qualifiers like unverified:true/false and date range queries.
1445
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1446
1446
  # sort::
1447
1447
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1448
1448
  class TranslationsSearchParams < ::OpenStruct
@@ -1471,7 +1471,7 @@ module RequestParams
1471
1471
  # order::
1472
1472
  # Order direction. Can be one of: asc, desc.
1473
1473
  # q::
1474
- # Filter the results. Supports text queries with same results as in Translation Center and qualifiers such as unverified:true/false as well as date range queries.
1474
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1475
1475
  # sort::
1476
1476
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1477
1477
  class TranslationsUnverifyParams < ::OpenStruct
@@ -1500,7 +1500,7 @@ module RequestParams
1500
1500
  # order::
1501
1501
  # Order direction. Can be one of: asc, desc.
1502
1502
  # q::
1503
- # Filter the results. Supports text queries with the same results as in the Translation Center as well as qualifiers like unverified:true/false and date range queries.
1503
+ # Specify a <a href="/api/v2/examples/#word-matching-examples">search term query</a> including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21</code> for date range queries</li> </ul> Find more examples <a href="/api/v2/examples/">here</a>.
1504
1504
  # sort::
1505
1505
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1506
1506
  class TranslationsVerifyParams < ::OpenStruct
@@ -87,11 +87,15 @@ module PhraseApp
87
87
  path)
88
88
 
89
89
 
90
+ if PhraseApp::Auth.debug
91
+ puts "-------"
92
+ puts "data:"
93
+ puts data.inspect
94
+ end
90
95
 
91
- puts "data:"
92
- puts data.inspect
93
96
  req.body = data
94
97
 
98
+
95
99
  if ctype != ""
96
100
  req["Content-Type"] = ctype
97
101
  end
@@ -111,11 +115,21 @@ module PhraseApp
111
115
  req["User-Agent"] = API_CLIENT_IDENTIFIER
112
116
 
113
117
  uri = URI.parse(PhraseApp::Auth.host)
118
+
119
+ if PhraseApp::Auth.debug
120
+ puts "uri:"
121
+ puts uri.inspect
122
+ end
123
+
114
124
  http = Net::HTTP.new(uri.host, uri.port)
115
125
  http.use_ssl = true
116
126
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
117
- if ENV['DEBUG']
118
- puts "#{req.method} #{req.path}"
127
+ if PhraseApp::Auth.debug
128
+ puts "method:"
129
+ puts req.method
130
+ puts "path:"
131
+ puts req.path
132
+ puts "body:"
119
133
  puts req.body.inspect
120
134
  puts "-------"
121
135
  end
@@ -1,3 +1,3 @@
1
1
  module PhraseApp
2
- VERSION = '1.0.13'
2
+ VERSION = '1.0.15'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phraseapp-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhraseApp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-10 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PhraseApp API client libary
14
14
  email: