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 +4 -4
- data/README.md +3 -1
- data/lib/shopkeep_reports/client.rb +2 -2
- data/lib/shopkeep_reports/configuration.rb +3 -2
- data/lib/shopkeep_reports/version.rb +1 -1
- data/lib/shopkeep_reports.rb +0 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d87c439a9d028511ab8ea6379b2c0457f6e03f39
|
4
|
+
data.tar.gz: 05ef240aa2f2e40dd49a70f87892e11ee512be9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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(
|
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
|
data/lib/shopkeep_reports.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|