Module: Docdata::Config

Defined in:
lib/docdata/config.rb

Overview

Configuration object for storing some parameters required for making transactions

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.passwordString

Returns Your DocData password.

Returns:

  • (String)

    Your DocData password



10
11
12
# File 'lib/docdata/config.rb', line 10

def password
  @password
end

.return_urlString

Returns Base return URL.

Returns:

  • (String)

    Base return URL



14
15
16
# File 'lib/docdata/config.rb', line 14

def return_url
  @return_url
end

.test_modeBoolean

Returns Test mode switch.

Returns:

  • (Boolean)

    Test mode switch



12
13
14
# File 'lib/docdata/config.rb', line 12

def test_mode
  @test_mode
end

.usernameString

Note:

The is a required parameter.

Returns Your DocData username.

Returns:

  • (String)

    Your DocData username



8
9
10
# File 'lib/docdata/config.rb', line 8

def username
  @username
end

Class Method Details

.init!Hash

Set's the default value's to nil and false

Returns:

  • (Hash)

    configuration options



19
20
21
22
23
24
25
26
# File 'lib/docdata/config.rb', line 19

def init!
  @defaults = {
    :@username   => nil,
    :@password   => nil,
    :@test_mode  => false,
    :@return_url => nil
  }
end

.reset!Hash

Resets the value's to there previous value (instance_variable)

Returns:

  • (Hash)

    configuration options



30
31
32
# File 'lib/docdata/config.rb', line 30

def reset!
  @defaults.each { |key, value| instance_variable_set(key, value) }
end

.update!Hash

Set's the new value's as instance variables

Returns:

  • (Hash)

    configuration options



36
37
38
39
40
# File 'lib/docdata/config.rb', line 36

def update!
  @defaults.each do |key, value|
    instance_variable_set(key, value) unless instance_variable_defined?(key)
  end
end