Class: ShopkeepReports::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/shopkeep_reports/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accountObject

Returns the value of attribute account.



7
8
9
# File 'lib/shopkeep_reports/configuration.rb', line 7

def 
  @account
end

#emailObject

Returns the value of attribute email.



7
8
9
# File 'lib/shopkeep_reports/configuration.rb', line 7

def email
  @email
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/shopkeep_reports/configuration.rb', line 7

def password
  @password
end

#tmp_directoryObject

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

.instanceObject



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 = 
  @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

Returns:

  • (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