comer_de_tapas 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/comer_de_tapas/subscription.rb +11 -8
- data/lib/comer_de_tapas/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 581ba0c2dd6e3afcccaa2f54d488abf8bb7039d7
|
|
4
|
+
data.tar.gz: b7f0040150ca17fac7d81580a844901003558ece
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df5f387b94fcb6c1b36860e27787c040b39c6141e77e27895105b800074fb7cb2ee947df0d46f09664b2c2eb873b10c1ac6cf79b6a12cbfdead7961b0711fcb9
|
|
7
|
+
data.tar.gz: d4979d6e54fd92bf1dc2e46e2b77f2c8cabec22208b447922c7d60031fb8251c24cef320cd69075f3772c2570e20b437d621b3547e718848a614dd6faf611859
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
module ComerDeTapas
|
|
2
2
|
class Subscription
|
|
3
|
-
|
|
4
|
-
CredentialYamlKeyError = Class.new StandardError
|
|
5
|
-
CredentialYamlValueError = Class.new StandardError
|
|
3
|
+
KEYS = %w(email password save_path)
|
|
6
4
|
|
|
7
5
|
def initialize
|
|
8
|
-
|
|
6
|
+
abort 'Please run `comer_de_tapas init` first' unless File.exist? CREDENTIAL_FILE
|
|
9
7
|
|
|
10
8
|
set_subscription_data if subscription_data_valid?
|
|
11
9
|
end
|
|
@@ -25,7 +23,8 @@ module ComerDeTapas
|
|
|
25
23
|
@credential_yaml ||= YAML.load_file CREDENTIAL_FILE
|
|
26
24
|
end
|
|
27
25
|
|
|
28
|
-
#
|
|
26
|
+
# Return true if ~/.rubytapas/.credentials files are filled and correct.
|
|
27
|
+
# @return [Boolen]
|
|
29
28
|
def subscription_data_valid?
|
|
30
29
|
# empty credential file's size is about 50-55.
|
|
31
30
|
# 65 is when you have a very short email, password, and save_path.
|
|
@@ -38,12 +37,16 @@ module ComerDeTapas
|
|
|
38
37
|
credential_data_valid?(get_validate load_credential_data)
|
|
39
38
|
end
|
|
40
39
|
|
|
41
|
-
#
|
|
40
|
+
# Return true if passed-in data all match criteria.
|
|
41
|
+
# @return [Boolen]
|
|
42
42
|
def credential_data_valid? data
|
|
43
43
|
data.each do |hash|
|
|
44
44
|
hash.each do |k,v|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
abort <<-MSG unless KEYS.include? k
|
|
46
|
+
Probably have a typo in #{CREDENTIAL_FILE}: #{k}
|
|
47
|
+
Valid yaml keys: #{KEYS.join(', ')}.
|
|
48
|
+
MSG
|
|
49
|
+
abort "Please fill in #{k} in #{CREDENTIAL_FILE}" unless v
|
|
47
50
|
end
|
|
48
51
|
end
|
|
49
52
|
|