Class: IContact::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/i_contact/configuration.rb

Constant Summary collapse

REQUIRED_FIELDS =
[
  :app_id,
  :user_name,
  :password,
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
21
# File 'lib/i_contact/configuration.rb', line 17

def initialize(&block)
  yield(self) if block_given?
  @mode ||= :sandbox
  @api_version || '2.2'
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



8
9
10
# File 'lib/i_contact/configuration.rb', line 8

def 
  @account_id
end

#api_versionObject

Returns the value of attribute api_version.



6
7
8
# File 'lib/i_contact/configuration.rb', line 6

def api_version
  @api_version
end

#app_idObject

Returns the value of attribute app_id.



3
4
5
# File 'lib/i_contact/configuration.rb', line 3

def app_id
  @app_id
end

#client_folder_idObject

Returns the value of attribute client_folder_id.



9
10
11
# File 'lib/i_contact/configuration.rb', line 9

def client_folder_id
  @client_folder_id
end

#modeObject

Returns the value of attribute mode.



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

def mode
  @mode
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/i_contact/configuration.rb', line 5

def password
  @password
end

#user_nameObject

Returns the value of attribute user_name.



4
5
6
# File 'lib/i_contact/configuration.rb', line 4

def user_name
  @user_name
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
# File 'lib/i_contact/configuration.rb', line 23

def valid?
  REQUIRED_FIELDS.each do |field|
    return false if send(field).nil? || send(field) == ''
  end
  true
end