shopkeep_reports 1.0.0 → 1.0.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: 8dd1f8a99699ff380b7c06bcb7aa2f2734c09e7e
4
- data.tar.gz: 3da7a4f911d40da5a6a27963a2d60aa0da16d886
3
+ metadata.gz: d87c439a9d028511ab8ea6379b2c0457f6e03f39
4
+ data.tar.gz: 05ef240aa2f2e40dd49a70f87892e11ee512be9d
5
5
  SHA512:
6
- metadata.gz: 656e7facf7b193c31a6f3ece840362aa0d41bdb22407c2cb04f4c432be8dddcb1049662d4241182311fe8f090322728a1c44e421304e3c9b46638ccb699b2526
7
- data.tar.gz: f6ebbe962864a929dec07b726674279cc33f366ff11b51ea97af579c256998cf2b416d6ac34010425bf6e90c803879e0a57ffb890bc5158fa02eb61beb7c85e3
6
+ metadata.gz: ce70efb70778f776ff8f1696d0a9085b28de22442aac2a966e502e11408c93aa418cdf6c11a5b5036b3a82cb0dc8d90efe548ac0fbb8f1f41f6e3705e7ff0339
7
+ data.tar.gz: e2258ad6982ae4b2c9c20965e0c9d9d1ea545c3201f0d64356734a03edb8fb12faac3c87c19f7be0e742e3e2792a80a32428d325a8f283d2a87114fe7c1080cb
data/README.md CHANGED
@@ -23,7 +23,8 @@ Or install it yourself as:
23
23
  ```ruby
24
24
  # config/initializers/shopekeep.rb
25
25
  # ENV['SHOPKEEP_EMAIL'] & ENV['SHOPKEEP_PASSWORD'] & ENV['SHOPKEEP_ACCOUNT'] should be set
26
- ShopkeepReports.configure do
26
+ ShopkeepReports.configure do |c|
27
+ c.tmp_directory = Rails.root
27
28
  end
28
29
  ```
29
30
 
@@ -34,6 +35,7 @@ ShopkeepReports.configure do |c|
34
35
  c.email = 'me@example.com'
35
36
  c.password = 'my_password'
36
37
  c.account = 'awesomecompany'
38
+ c.tmp_directory = Rails.root
37
39
  end
38
40
  ```
39
41
 
@@ -44,7 +44,7 @@ module ShopkeepReports
44
44
  else
45
45
  file_uri = download_link.uri
46
46
  end
47
- file_name = File.join(ShopkeepReports.root, 'tmp', (file_uri.to_s.split('.csv').first.split('/').last + '.csv'))
47
+ file_name = File.join(configuration.tmp_directory, (file_uri.to_s.split('.csv').first.split('/').last + '.csv'))
48
48
  File.open(file_name, "wb") do |file|
49
49
  file_uri.open do |uri|
50
50
  file.write(uri.read)
@@ -61,7 +61,7 @@ module ShopkeepReports
61
61
  new_agent.cookie_jar = @@cookie_jar
62
62
  download = new_agent.get(report_link)
63
63
  file_body = download.body
64
- file_name = File.join(ShopkeepReports.root, 'tmp', download.filename)
64
+ file_name = File.join(configuration.tmp_directory, download.filename)
65
65
  File.open(file_name, "wb") do |file|
66
66
  file.write(file_body)
67
67
  end
@@ -4,7 +4,7 @@ module ShopkeepReports
4
4
  class Configuration
5
5
  include Singleton
6
6
 
7
- attr_accessor :email, :password, :account
7
+ attr_accessor :email, :password, :account, :tmp_directory
8
8
 
9
9
  def self.instance
10
10
  @@instance ||= new
@@ -14,6 +14,7 @@ module ShopkeepReports
14
14
  @email = default_email
15
15
  @password = default_password
16
16
  @account = default_account
17
+ @tmp_directory = "/tmp"
17
18
  args.each_pair do |option, value|
18
19
  self.send("#{option}=", value)
19
20
  end
@@ -21,7 +22,7 @@ module ShopkeepReports
21
22
 
22
23
  def valid?
23
24
  result = true
24
- [:email, :password, :account].each do |value|
25
+ [:email, :password, :account, :tmp_directory].each do |value|
25
26
  result = false if self.send(value).blank?
26
27
  end
27
28
  result
@@ -1,3 +1,3 @@
1
1
  module ShopkeepReports
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -16,8 +16,4 @@ module ShopkeepReports
16
16
  self.configuration ||= Configuration.instance
17
17
  yield(configuration)
18
18
  end
19
-
20
- def self.root
21
- File.dirname __dir__
22
- end
23
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopkeep_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kunwar Aditya Raghuwanshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler