e_m_typographer 0.0.1 → 0.0.2
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 +4 -4
- data/lib/e_m_typographer.rb +26 -4
- metadata +3 -10
- data/.gitignore +0 -15
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -31
- data/Rakefile +0 -2
- data/e_m_typographer.gemspec +0 -22
- data/lib/e_m_typographer/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 663b3a0525fb295928ca40e754d8e3ffc5228508
|
4
|
+
data.tar.gz: aac09b60d1a98458ddb7ca2a32a06a279e141d8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f149e59a41bf74008a7860e8a487ea140c9f23a27b850b37c997aa689db12696a994353e686fce25fa0e56700b579de9ae87065f5bb91dd4cd534bbfbe23fe
|
7
|
+
data.tar.gz: b04de42669eeb4d9ebdd05fa2f458b299aac67130e902ce921347aeb3230700b841a2643bc41bdf55b5a5b8e07ee12dc91d3cce2eeef81be0ef91339f140d922
|
data/lib/e_m_typographer.rb
CHANGED
@@ -1,7 +1,29 @@
|
|
1
|
-
require
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'json'
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
class EMTypographer
|
6
|
+
TYPOGRAPHER_REQUEST_URI = URI('http://mdash.ru/api.v1.php')
|
7
|
+
attr_accessor :text
|
8
|
+
|
9
|
+
def apply
|
10
|
+
response = send_typographer_post_request(text)
|
11
|
+
|
12
|
+
JSON.parse(response.body)['result'] if response && response.body['result']
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def send_typographer_post_request(text)
|
18
|
+
return if text.empty?
|
19
|
+
|
20
|
+
request = Net::HTTP.new(TYPOGRAPHER_REQUEST_URI.host, TYPOGRAPHER_REQUEST_URI.port)
|
21
|
+
request.post(TYPOGRAPHER_REQUEST_URI.path, post_query)
|
22
|
+
end
|
23
|
+
|
24
|
+
def post_query
|
25
|
+
"text=#{text}"
|
6
26
|
end
|
7
27
|
end
|
28
|
+
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Kolmakov
|
@@ -45,15 +45,8 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- ".gitignore"
|
49
|
-
- Gemfile
|
50
|
-
- LICENSE.txt
|
51
|
-
- README.md
|
52
|
-
- Rakefile
|
53
|
-
- e_m_typographer.gemspec
|
54
48
|
- lib/e_m_typographer.rb
|
55
|
-
|
56
|
-
homepage: ''
|
49
|
+
homepage: https://github.com/fishtag/e_m_typographer
|
57
50
|
licenses:
|
58
51
|
- MIT
|
59
52
|
metadata: {}
|
@@ -73,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
66
|
version: '0'
|
74
67
|
requirements: []
|
75
68
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.2.
|
69
|
+
rubygems_version: 2.2.0
|
77
70
|
signing_key:
|
78
71
|
specification_version: 4
|
79
72
|
summary: Allows you to format yout text using http://mdash.ru API.
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 AntonKolmakov
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# EMTypographer
|
2
|
-
|
3
|
-
Allows you to format yout text using http://mdash.ru API.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'e_m_typographer'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install e_m_typographer
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
24
|
-
|
25
|
-
## Contributing
|
26
|
-
|
27
|
-
1. Fork it ( https://github.com/[my-github-username]/e_m_typographer/fork )
|
28
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
-
5. Create a new Pull Request
|
data/Rakefile
DELETED
data/e_m_typographer.gemspec
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'e_m_typographer/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "e_m_typographer"
|
8
|
-
spec.version = EMTypographer::VERSION
|
9
|
-
spec.authors = ['Anton Kolmakov', 'Timur Khafizov']
|
10
|
-
spec.description = %q{Allows you to format yout text using http://mdash.ru API.}
|
11
|
-
spec.summary = %q{Allows you to format yout text using http://mdash.ru API.}
|
12
|
-
spec.homepage = ""
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = ["lib"]
|
19
|
-
|
20
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
21
|
-
spec.add_development_dependency 'rspec'
|
22
|
-
end
|