Class: AutotaskRuby::ZoneInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/autotask_ruby/zone_info.rb

Constant Summary collapse

ENDPOINT =
'https://webservices.autotask.net/ATServices/1.5/atws.asmx'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ ZoneInfo

Returns a new instance of ZoneInfo.



9
10
11
12
13
# File 'lib/autotask_ruby/zone_info.rb', line 9

def initialize(username)
  @client = Savon.client(wsdl: './atws.wsdl', endpoint: ENDPOINT)
  @raw_result = @client.call(:get_zone_info, message: { 'UserName' => username })
  @zone_info = @raw_result.body[:get_zone_info_response][:get_zone_info_result]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *_args) ⇒ Object

Parameters:

  • method (Object)
  • _args (Array)

Returns:

  • (Object)


30
31
32
# File 'lib/autotask_ruby/zone_info.rb', line 30

def method_missing(method, *_args)
  @zone_info[method]
end

Instance Attribute Details

#raw_resultObject (readonly)

Returns the value of attribute raw_result.



5
6
7
# File 'lib/autotask_ruby/zone_info.rb', line 5

def raw_result
  @raw_result
end

Instance Method Details

#error_codeObject



15
16
17
# File 'lib/autotask_ruby/zone_info.rb', line 15

def error_code
  @zone_info[:error_code].to_i
end

#urlObject



23
24
25
# File 'lib/autotask_ruby/zone_info.rb', line 23

def url
  @zone_info[:url]
end

#web_urlObject



19
20
21
# File 'lib/autotask_ruby/zone_info.rb', line 19

def web_url
  @zone_info[:web_url]
end