emojidex 0.5.1 → 0.5.2

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: c9a0a7030ddea5f1db4f22841a0abf07236d1092
4
- data.tar.gz: 587a65ce35b88e0cc5e6d79f158b7e8c467abcbb
3
+ metadata.gz: 648e55c77ad697bef35fb98a1cd651781a530428
4
+ data.tar.gz: 201f1b2592e3a3fca196ade4736da7c5b4a3c2b4
5
5
  SHA512:
6
- metadata.gz: cad92f427bf8968bd1dc181bffbdbecd964f11187851f9aeb5ab5039628db47b372f9bf0643e965d520846d4894914a1ba74e853d67017a8c38963048bfe1704
7
- data.tar.gz: 3b5c9512c07b1700156cb9813387977b1805e167dd495a2e02f60c20d9f3dbaf2178151dd6a51a57184cd3e8dec86e5e800b89e69bd05c9470ebbc3ffc31caf8
6
+ metadata.gz: 674d45345806698569d741718e819e4e76a44de615ba30a02ae2e05b236ee9c9cfe06e88b20e8310c51492d2127622194dd5b693a8c76aa620f1c21bee2bd938
7
+ data.tar.gz: 321aa8d0fb717b48230b2414615346ee43d8c3ce00565af5c0d0659cf05e616acf5d64dc92ea770e187bcb48fee4a526786644413eb72834a334b6852935f7be
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'emojidex'
3
- s.version = '0.5.1'
3
+ s.version = '0.5.2'
4
4
  s.license = 'emojiOL'
5
5
  s.summary = 'emojidex Ruby tools'
6
6
  s.description = 'emojidex emoji handling, search and lookup, listing and caching functionality' \
@@ -15,7 +15,8 @@ Gem::Specification.new do |s|
15
15
  ['emojidex.gemspec']
16
16
  s.require_paths = ['lib']
17
17
 
18
- s.add_dependency 'faraday', '~> 0.10', '~> 0.10.1'
19
- s.add_dependency 'faraday_middleware', '~> 0.10', '~> 0.10.1'
20
- s.add_dependency 'typhoeus', '~> 1.1', '~> 1.1.2'
18
+ s.add_dependency 'faraday', '~> 0.13', '~> 0.13.1'
19
+ s.add_dependency 'faraday_middleware', '~> 0.12', '~> 0.12.2'
20
+ s.add_dependency 'typhoeus', '~> 1.3', '~> 1.3.0'
21
+ s.add_dependency 'msgpack', '~> 1.2'
21
22
  end
@@ -47,7 +47,7 @@ module Emojidex
47
47
  # the emoji short codes in the locale [language] specified (defaults to english).
48
48
  def self.moji_codes(locale = Emojidex::Defaults.lang)
49
49
  begin
50
- res = Emojidex::Service::Transactor.get('moji_codes', locale: locale)
50
+ res = Emojidex::Service::Transactor.get('moji_codes.msgpack', locale: locale)
51
51
  rescue
52
52
  return { moji_string: '', moji_array: [], moji_index: {} }
53
53
  end
@@ -3,6 +3,7 @@ require 'faraday_middleware'
3
3
  require 'typhoeus'
4
4
  require 'typhoeus/adapters/faraday'
5
5
  require 'json'
6
+ require 'msgpack'
6
7
  require_relative '../../emojidex'
7
8
  require_relative 'error'
8
9
 
@@ -30,7 +31,6 @@ module Emojidex
30
31
  def self.get(endpoint, params = {})
31
32
  response = connect.get(
32
33
  "#{api_url}#{URI.encode(endpoint)}", params)
33
-
34
34
  _status_raiser(response)
35
35
  _datafy_json(response.body)
36
36
  end
@@ -53,6 +53,9 @@ module Emojidex
53
53
 
54
54
  def self.download(file_subpath)
55
55
  connect.get(URI.escape("#{cdn_url}#{file_subpath.tr(' ', '_')}"))
56
+ rescue Faraday::ConnectionFailed
57
+ _kludge_certs
58
+ connect.get(URI.escape("#{cdn_url}#{file_subpath.tr(' ', '_')}"))
56
59
  end
57
60
 
58
61
  def self.connect
@@ -62,10 +65,11 @@ module Emojidex
62
65
  #conn.request :retry, max: @@retries, interval: 0.05, interval_randomness: 0.5,
63
66
  # backoff_factor: 2
64
67
  # conn.response :logger
68
+ conn.headers['Accept'] = 'application/msgpack'
65
69
  conn.use FaradayMiddleware::FollowRedirects, limit: 5
66
70
  conn.adapter :typhoeus #Faraday.default_adapter
67
71
  end
68
- _kludge_windows if Gem.win_platform?
72
+ _kludge_certs if Gem.win_platform?
69
73
  @@connection
70
74
  end
71
75
 
@@ -94,20 +98,20 @@ module Emojidex
94
98
 
95
99
  def self._extract_status_line(response)
96
100
  data = _datafy_json(response.body)
97
- status_line = (data.key?(:status) ? data[:status] : '')
98
- status_line
101
+ data.fetch(:status, '')
99
102
  end
100
103
 
101
104
  def self._datafy_json(body)
102
105
  begin
103
- data = JSON.parse(body, symbolize_names: true)
106
+ body = MessagePack.unpack(body)
107
+ data = JSON.parse(body.to_json, symbolize_names: true)
104
108
  rescue JSON::ParserError
105
109
  raise Error::InvalidJSON, 'could not parse JSON'
106
110
  end
107
111
  data
108
112
  end
109
113
 
110
- def self._kludge_windows
114
+ def self._kludge_certs
111
115
  cert_loc = "#{__dir__}/cacert.pem"
112
116
  unless File.exist? cert_loc
113
117
  response = @@connection.get('http://curl.haxx.se/ca/cacert.pem')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emojidex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,60 +16,74 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.10'
19
+ version: '0.13'
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: 0.10.1
22
+ version: 0.13.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.10'
29
+ version: '0.13'
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 0.10.1
32
+ version: 0.13.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday_middleware
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.10'
39
+ version: '0.12'
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 0.10.1
42
+ version: 0.12.2
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.10'
49
+ version: '0.12'
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: 0.10.1
52
+ version: 0.12.2
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: typhoeus
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.1'
59
+ version: '1.3'
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 1.1.2
62
+ version: 1.3.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.1'
69
+ version: '1.3'
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: 1.1.2
72
+ version: 1.3.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: msgpack
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '1.2'
80
+ type: :runtime
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '1.2'
73
87
  description: emojidex emoji handling, search and lookup, listing and caching functionality
74
88
  and user info (favorites/etc).
75
89
  email: info@emojidex.com
@@ -125,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
139
  version: '0'
126
140
  requirements: []
127
141
  rubyforge_project:
128
- rubygems_version: 2.6.11
142
+ rubygems_version: 2.6.14
129
143
  signing_key:
130
144
  specification_version: 4
131
145
  summary: emojidex Ruby tools