Class: ShopkeepReports::Configuration
- Inherits:
-
Object
- Object
- ShopkeepReports::Configuration
- Includes:
- Singleton
- Defined in:
- lib/shopkeep_reports/configuration.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#email ⇒ Object
Returns the value of attribute email.
-
#password ⇒ Object
Returns the value of attribute password.
-
#tmp_directory ⇒ Object
Returns the value of attribute tmp_directory.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
7 8 9 |
# File 'lib/shopkeep_reports/configuration.rb', line 7 def account @account end |
#email ⇒ Object
Returns the value of attribute email.
7 8 9 |
# File 'lib/shopkeep_reports/configuration.rb', line 7 def email @email end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/shopkeep_reports/configuration.rb', line 7 def password @password end |
#tmp_directory ⇒ Object
Returns the value of attribute tmp_directory.
7 8 9 |
# File 'lib/shopkeep_reports/configuration.rb', line 7 def tmp_directory @tmp_directory end |
Class Method Details
.instance ⇒ Object
9 10 11 |
# File 'lib/shopkeep_reports/configuration.rb', line 9 def self.instance @@instance ||= new end |
Instance Method Details
#init(args = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/shopkeep_reports/configuration.rb', line 13 def init(args = {}) @email = default_email @password = default_password @account = default_account @tmp_directory = "/tmp" args.each_pair do |option, value| self.send("#{option}=", value) end end |
#transaction_uri(path) ⇒ Object
35 36 37 |
# File 'lib/shopkeep_reports/configuration.rb', line 35 def transaction_uri(path) "https://www.shopkeepapp.com" + path end |
#uri(path) ⇒ Object
31 32 33 |
# File 'lib/shopkeep_reports/configuration.rb', line 31 def uri(path) "https://" + @account + ".shopkeepapp.com" + path end |
#valid? ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/shopkeep_reports/configuration.rb', line 23 def valid? result = true [:email, :password, :account, :tmp_directory].each do |value| result = false if self.send(value).blank? end result end |