atol 0.1.2 → 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: c0ff541b6a0a75a0f0389369f92a39fca0db4301
4
- data.tar.gz: d3eb8d7e57ac97399f714faad701f110de417f5b
3
+ metadata.gz: 17d4ad372d79d210e557557a3f6cc80f77068e75
4
+ data.tar.gz: da90b555963964a89478f4d1d49c04a3b8555020
5
5
  SHA512:
6
- metadata.gz: aa5424db538ad60b2eb9bb347c5e2022841998f162205086171c69d7efec095df465f39e14dc01ee30fbe4d58789c8cb076fca86fb9ea7a77a4515e66332faf4
7
- data.tar.gz: 68c78330cc87bf04226781ec66f528b5233dda1a1a0b59dd70e7ec95cbd7e8342cc242813f1c290158556552cb63f714ddf4565286deedba536158fa522ea995
6
+ metadata.gz: 7ae186d1878efeaef1b3a7a91cac0a63b2b3ba064e41126d36d2ecbcca911975b9b8065f814a51c87935c9fa15c38857ff595ce2c28ac973413bf56f5bb43864
7
+ data.tar.gz: 85d2b78aa0f1ece50c515231666490368521fd5614fe659670f393403a5b0b705e7fde0d7c6580a58ff1ba1d0703fae0cb5baeaabd77ca825b32c3b906164294
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atol (0.1.2)
4
+ atol (0.2)
5
5
  anyway_config (~> 1.0)
6
6
 
7
7
  GEM
data/lib/atol.rb CHANGED
@@ -4,7 +4,7 @@ require 'atol/request'
4
4
  require 'atol/transaction'
5
5
 
6
6
  module Atol
7
- URL = "http://online.atol.ru/possystem/#{Atol::Version::API}".freeze
7
+ URL = "https://online.atol.ru/possystem/#{Atol::Version::API}".freeze
8
8
  ENCODING = 'utf-8'.freeze
9
9
  TIMESTAMP_FORMAT = '%d.%m.%Y %H:%M:%S'.freeze
10
10
 
@@ -15,7 +15,10 @@ module Atol
15
15
 
16
16
  def call
17
17
  uri = URI(url)
18
- Net::HTTP.get_response(uri)
18
+
19
+ http = Net::HTTP.new(uri.host, uri.port)
20
+ http.use_ssl = true
21
+ http.get(uri.request_uri)
19
22
  end
20
23
 
21
24
  private
@@ -28,7 +28,9 @@ module Atol
28
28
  uri = URI(Atol::URL + PATH)
29
29
  uri.query = URI.encode_www_form(login: login, pass: password)
30
30
 
31
- Net::HTTP.get_response(uri)
31
+ http = Net::HTTP.new(uri.host, uri.port)
32
+ http.use_ssl = true
33
+ http.get(uri.request_uri)
32
34
  end
33
35
 
34
36
  private
@@ -32,7 +32,7 @@ module Atol
32
32
  req_logger.call(req)
33
33
  end
34
34
 
35
- res = Net::HTTP.start(uri.hostname, uri.port) do |http|
35
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
36
36
  http.request(req)
37
37
  end
38
38
 
@@ -14,19 +14,15 @@ module Atol
14
14
  @body[:name] = name
15
15
  @body[:price] = price.to_f
16
16
  @body[:quantity] = quantity.to_f
17
- @body[:sum] = @body[:price] * @body[:quantity]
17
+ @body[:sum] = (@body[:price] * @body[:quantity]).to_f.round(2)
18
18
  @body[:tax] = @config.default_tax
19
19
  end
20
20
 
21
21
  def to_h
22
- body.clone
22
+ @body.clone
23
23
  end
24
-
25
- private
26
-
27
- attr_reader :body
28
24
  end
29
25
  end
30
26
  end
31
27
  end
32
- end
28
+ end
data/lib/atol/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Atol
2
2
  module Version
3
3
  API = 'v3'.freeze
4
- LIB = '0.1.2'.freeze
4
+ LIB = '0.2'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - GeorgeGorbanev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-07 00:00:00.000000000 Z
11
+ date: 2018-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config