e_m_typographer 0.0.1 → 0.0.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: 7e8f5ec90410722a9afd4d4db450e7577a903dca
4
- data.tar.gz: 8bdf1c631f1ab1c30edb364752fe5bc8c6809a80
3
+ metadata.gz: 663b3a0525fb295928ca40e754d8e3ffc5228508
4
+ data.tar.gz: aac09b60d1a98458ddb7ca2a32a06a279e141d8e
5
5
  SHA512:
6
- metadata.gz: 8402d9259cd5821c64a16c0dfae05baee60f965828cf6093faebacfbde867c3223d4a94592ff9e93df0efe7ca72c08a9438569f0a078e88a3db4d017ce212fa0
7
- data.tar.gz: a62299c48e86e930ced016db84fbdcff22d32f39f886969ce98ef8f967bd12e9114b4b82429284ac817c484c69de7818b7b502982ce4d65977deb0e7631ee341
6
+ metadata.gz: f4f149e59a41bf74008a7860e8a487ea140c9f23a27b850b37c997aa689db12696a994353e686fce25fa0e56700b579de9ae87065f5bb91dd4cd534bbfbe23fe
7
+ data.tar.gz: b04de42669eeb4d9ebdd05fa2f458b299aac67130e902ce921347aeb3230700b841a2643bc41bdf55b5a5b8e07ee12dc91d3cce2eeef81be0ef91339f140d922
@@ -1,7 +1,29 @@
1
- require "e_m_typographer/version"
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'json'
2
4
 
3
- module EMTypographer
4
- def self.greet
5
- puts 'Develop with pleasure!'
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.1
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
- - lib/e_m_typographer/version.rb
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.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
@@ -1,15 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- *.gem
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in e_m_typographer.gemspec
4
- gemspec
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
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
@@ -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
@@ -1,3 +0,0 @@
1
- module EMTypographer
2
- VERSION = "0.0.1"
3
- end