Class: SoapyCake::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/soapy_cake/client.rb

Direct Known Subclasses

Admin, AdminAddedit, AdminTrack, Affiliate

Constant Summary collapse

HEADERS =
{ 'Content-Type' => 'application/soap+xml;charset=UTF-8' }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
14
15
# File 'lib/soapy_cake/client.rb', line 8

def initialize(opts = {})
  @opts = opts
  @domain = fetch_opt(:domain) || raise(Error, 'Cake domain missing')
  @api_key = fetch_opt(:api_key) || raise(Error, 'Cake API key missing')
  @retry_count = fetch_opt(:retry_count, 4)
  @write_enabled = ['yes', true].include?(fetch_opt(:write_enabled))
  @time_converter = TimeConverter.new(fetch_opt(:time_zone), fetch_opt(:time_offset))
end

Instance Method Details

#read_only?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/soapy_cake/client.rb', line 21

def read_only?
  !write_enabled
end

#xml_response?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/soapy_cake/client.rb', line 17

def xml_response?
  opts[:xml_response] == true
end