ayadn 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/lib/ayadn/cnx.rb +2 -17
- data/lib/ayadn/fileops.rb +5 -7
- data/lib/ayadn/nicerank.rb +9 -3
- data/lib/ayadn/version.rb +1 -1
- 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: 4844f6ffe9a330e65f8af4cdd518fe7753e36890
|
4
|
+
data.tar.gz: e9b0f90c5add38d0a938303a89908efe1ea7bf2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed02423f52ee4cafe6836b95e7d8a1b3babd71a3314ff2efb0fe657663302b2a732f74f7f71b790a9b116577603427a6e7633d8d8f2ef0633ae3e022b1328a40
|
7
|
+
data.tar.gz: 2bd08d85a8c479e23cd048579505c54fb757c3eb3b689e13005119137ac02a7962a8e60b1604509c305c324387ef78bc61daa89993117293527dfb99932f9bf8
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
# 1.4.
|
1
|
+
# 1.4.2 - CNX
|
2
2
|
|
3
|
-
-
|
3
|
+
- Ayadn is more resilient to connectivity errors
|
4
|
+
- Better handling of filenames when uploading
|
5
|
+
|
6
|
+
# 1.4.1 - NowPlaying
|
7
|
+
|
8
|
+
- A few fixes in the NowPlaying section
|
4
9
|
|
5
10
|
# 1.4.0 - 'Florian'
|
6
11
|
|
data/lib/ayadn/cnx.rb
CHANGED
@@ -17,15 +17,7 @@ module Ayadn
|
|
17
17
|
Debug.http response, url
|
18
18
|
check_nr response, url
|
19
19
|
end
|
20
|
-
rescue SocketError => e
|
21
|
-
if working == true
|
22
|
-
working = false
|
23
|
-
sleep 0.5
|
24
|
-
retry
|
25
|
-
end
|
26
|
-
Errors.nr "URL: #{url}"
|
27
|
-
return {'meta' => {'code' => 666}, 'data' => "#{e}"}.to_json
|
28
|
-
rescue SystemCallError => e
|
20
|
+
rescue SocketError, SystemCallError, OpenSSL::SSL::SSLError, RestClient::RequestTimeout => e
|
29
21
|
if working == true
|
30
22
|
working = false
|
31
23
|
sleep 0.5
|
@@ -57,20 +49,13 @@ module Ayadn
|
|
57
49
|
Debug.http response, url
|
58
50
|
check response
|
59
51
|
end
|
60
|
-
rescue SocketError => e
|
52
|
+
rescue SocketError, SystemCallError, OpenSSL::SSL::SSLError, RestClient::RequestTimeout => e
|
61
53
|
if try_cnx < 4
|
62
54
|
try_cnx = retry_adn 10, try_cnx
|
63
55
|
retry
|
64
56
|
end
|
65
57
|
puts "\nConnection error.".color(:red)
|
66
58
|
Errors.global_error("cnx.rb/get_response_from", url, e)
|
67
|
-
rescue SystemCallError => e
|
68
|
-
if try_cnx < 4
|
69
|
-
try_cnx = retry_adn 15, try_cnx
|
70
|
-
retry
|
71
|
-
end
|
72
|
-
puts "\nConnection error.".color(:red)
|
73
|
-
Errors.global_error("cnx.rb/get_response_from", url, e)
|
74
59
|
rescue => e
|
75
60
|
Errors.global_error("cnx.rb/get_response_from", url, e)
|
76
61
|
end
|
data/lib/ayadn/fileops.rb
CHANGED
@@ -41,17 +41,15 @@ module Ayadn
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.upload(
|
44
|
+
def self.upload(file, token)
|
45
45
|
begin
|
46
|
-
|
47
|
-
file = temp.gsub('\-', '-')
|
48
|
-
case File.extname(path).downcase
|
46
|
+
case File.extname(file).downcase
|
49
47
|
when ".png"
|
50
|
-
`curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F "content
|
48
|
+
`curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F "content=@'#{file}';type=image/png" -F 'public=true' -X POST`
|
51
49
|
when ".gif"
|
52
|
-
`curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F "content
|
50
|
+
`curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F "content=@'#{file}';type=image/gif" -F 'public=true' -X POST`
|
53
51
|
else #jpg or jpeg or JPG or JPEG, automatically recognized as such
|
54
|
-
`curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F content
|
52
|
+
`curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F content=@'#{file}' -F 'public=true' -X POST`
|
55
53
|
end
|
56
54
|
rescue Errno::ENOENT
|
57
55
|
abort(Status.no_curl)
|
data/lib/ayadn/nicerank.rb
CHANGED
@@ -45,10 +45,16 @@ module Ayadn
|
|
45
45
|
|
46
46
|
unless get_these.empty?
|
47
47
|
got = CNX.get "#{@url}#{get_these.join(',')}&show_details=Y"
|
48
|
-
|
49
|
-
|
48
|
+
blank = JSON.parse({'meta' => {'code' => 404}, 'data' => []}.to_json)
|
49
|
+
if got.nil? || got == ""
|
50
|
+
parsed = blank
|
50
51
|
else
|
51
|
-
|
52
|
+
parsed = JSON.parse(got)
|
53
|
+
end
|
54
|
+
if parsed['meta']['code'] != 200
|
55
|
+
resp = blank
|
56
|
+
else
|
57
|
+
resp = parsed
|
52
58
|
end
|
53
59
|
|
54
60
|
if resp['meta']['code'] != 200
|
data/lib/ayadn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ayadn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|