Module: EmaySoap::Configurable

Included in:
EmaySoap, Client
Defined in:
lib/emay_soap/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cdkeyObject

Returns the value of attribute cdkey.



3
4
5
# File 'lib/emay_soap/configurable.rb', line 3

def cdkey
  @cdkey
end

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/emay_soap/configurable.rb', line 3

def key
  @key
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/emay_soap/configurable.rb', line 3

def password
  @password
end

#prefixObject

Returns the value of attribute prefix.



3
4
5
# File 'lib/emay_soap/configurable.rb', line 3

def prefix
  @prefix
end

Class Method Details

.default_optionsObject



6
7
8
9
10
11
12
13
# File 'lib/emay_soap/configurable.rb', line 6

def default_options
  {
    prefix: ENV['EMAY_PREFIX'],
    cdkey: ENV['EMAY_CDKEY'],
    key: ENV['EMAY_KEY'], # session key, max length is 15
    password: ENV['EMAY_PASSWORD']
  }
end

.setup_keysObject



15
16
17
# File 'lib/emay_soap/configurable.rb', line 15

def setup_keys
  @setup_keys ||= [:prefix, :cdkey, :key, :password]
end

Instance Method Details

#optionsObject



20
21
22
23
24
25
# File 'lib/emay_soap/configurable.rb', line 20

def options
  ary = EmaySoap::Configurable.setup_keys.map do |key|
    [key, send(key)]
  end
  Hash[ary]
end

#setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



27
28
29
# File 'lib/emay_soap/configurable.rb', line 27

def setup
  yield self
end