iiko 0.1.0 → 0.1.1

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: 0c41ceb6ecad3df56e03e7b0b2473fbe2bc6814f
4
- data.tar.gz: 3cdf38bfccc32b09e69b4ec1795e818fdd5d69d2
3
+ metadata.gz: 3ce3a8127b3d546319f4a3c7f3c0e05bbf1ee978
4
+ data.tar.gz: c5be391404b27b224bdea673e50082035cd0b0f5
5
5
  SHA512:
6
- metadata.gz: 601ff7e3d3d22fd1c6175c4d380a7893423c1b3787b9ef1df5b7aa252f54570630ad6d442f9ea26f34c94e8dec60c65de5b9e3eede51baa604763843f7be479f
7
- data.tar.gz: facce906edb3bfb2dd880af6a3eb2cf8461d4cfb56648ba6e302838980e4fc7ceac69358a5dc1ff1e3ac743988bb7fe1cb35118eacf1466e3def75086012381c
6
+ metadata.gz: 68f887b96ecfd408c89dacf874a7498e7e637e1937f0ec45c1e44ba8e96ae96adabc82351c085b0e72add7ac85bd5505955a74b43692090ba2246539ee6af1c5
7
+ data.tar.gz: 95c44c72f1b32b2a90635e613e17ce8f565d3df0e77f3b5f60e1f1d5b1d0396c4344adc84af37193713e01f722b735b5d65e626acf03b859d50db1c82fc14193
@@ -1,3 +1,3 @@
1
1
  module Iiko
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,13 +4,16 @@ module Iiko
4
4
  class Web
5
5
  IIKO_USER_AGENT = 'iiko agent'
6
6
 
7
- attr_reader :agent, :result, :files, :settings, :logged
7
+ attr_reader :agent, :result, :files, :settings, :logged, :headers
8
8
 
9
9
  def initialize(settings)
10
10
  @settings = settings # :url, :user, :password, :user_agent
11
11
  validate_arguments
12
12
 
13
13
  @agent = Mechanize.new { |agent| agent.user_agent = settings[:user_agent] || IIKO_USER_AGENT }
14
+
15
+ #default_headers = { "Accept-Language" => 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4' }
16
+ #@headers = settings[:headers] ? settings[:headers].merge(default_headers) : default_headers
14
17
  end
15
18
 
16
19
  def login
@@ -41,19 +44,18 @@ module Iiko
41
44
  private
42
45
 
43
46
  def write_file(file_name = nil, name, extension)
44
- if file_name
45
- File.write(file_name, result.body)
46
- else
47
+ unless file_name
47
48
  file = extra_file(name, extension)
48
- file.write(result.body)
49
+ #file.write(result.body)
49
50
  file.close
50
51
  file_name = file.path
51
52
  end
53
+ File.write(file_name, result.body, mode: 'wb')
52
54
  file_name
53
55
  end
54
56
 
55
57
  def extra_file(name, extension)
56
- Tempfile.new([name, ".#{extension}"])
58
+ Tempfile.new([name, ".#{extension}"], encoding: 'ascii-8bit')
57
59
  end
58
60
 
59
61
  def validate_arguments
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vickodin