e_m_typographer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/e_m_typographer.rb +3 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 447d945fbb0431822646bf10ee0308c1428bf0c9
|
4
|
+
data.tar.gz: 95d2d472ec3f8cd0a2bbfccdc92bcd3e81955fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb7290f6ba4a9d5d97112aa56eb51bf42cfa37712509e5f176a8a69163af59f25d7bcba9ca8578801090f3e549d600af68fbe15007a3f809bf25eeb602fac817
|
7
|
+
data.tar.gz: c291d436fb9a47502d533dd9e9f602af961b88d676e104b2c81612e8640b538109941214f35034d6aa4de778296ab7989a95f889eba6c89ba83fabf199502993
|
data/lib/e_m_typographer.rb
CHANGED
@@ -4,9 +4,8 @@ require 'json'
|
|
4
4
|
|
5
5
|
class EMTypographer
|
6
6
|
TYPOGRAPHER_REQUEST_URI = URI('http://mdash.ru/api.v1.php')
|
7
|
-
attr_accessor :text
|
8
7
|
|
9
|
-
def apply
|
8
|
+
def self.apply(text)
|
10
9
|
response = send_typographer_post_request(text)
|
11
10
|
|
12
11
|
JSON.parse(response.body)['result'] if response && response.body['result']
|
@@ -14,16 +13,11 @@ class EMTypographer
|
|
14
13
|
|
15
14
|
private
|
16
15
|
|
17
|
-
def send_typographer_post_request(text)
|
16
|
+
def self.send_typographer_post_request(text)
|
18
17
|
return if text.empty?
|
19
18
|
|
20
19
|
request = Net::HTTP.new(TYPOGRAPHER_REQUEST_URI.host, TYPOGRAPHER_REQUEST_URI.port)
|
21
|
-
request.post(TYPOGRAPHER_REQUEST_URI.path,
|
22
|
-
end
|
23
|
-
|
24
|
-
def post_query
|
25
|
-
"text=#{text}"
|
20
|
+
request.post(TYPOGRAPHER_REQUEST_URI.path, "text=#{text}")
|
26
21
|
end
|
27
22
|
end
|
28
23
|
|
29
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e_m_typographer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Kolmakov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09-
|
12
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
-
description: Allows you to format
|
42
|
+
description: Allows you to format your text using http://mdash.ru API.
|
43
43
|
email:
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
@@ -69,5 +69,5 @@ rubyforge_project:
|
|
69
69
|
rubygems_version: 2.2.0
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
|
-
summary: Allows you to format
|
72
|
+
summary: Allows you to format your text using http://mdash.ru API.
|
73
73
|
test_files: []
|