Class: Zm::Client::SoapContext

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/soap_request/soap_context.rb

Instance Method Summary collapse

Constructor Details

#initializeSoapContext

attr_reader :token, :user_agent, :target_server



8
9
10
11
12
# File 'lib/zm/client/soap_request/soap_context.rb', line 8

def initialize
  @token = nil
  @user_agent = 'zmsoap'
  @target_server = nil
end

Instance Method Details

#target_server(str) ⇒ Object



24
25
26
27
# File 'lib/zm/client/soap_request/soap_context.rb', line 24

def target_server(str)
  @target_server = str
  self
end

#to_hashObject



29
30
31
32
33
34
35
# File 'lib/zm/client/soap_request/soap_context.rb', line 29

def to_hash
  {
    authToken: @token,
    userAgent: { name: @user_agent },
    targetServer: @target_server
  }.delete_if { |_, v| v.nil? }
end

#token(str) ⇒ Object



14
15
16
17
# File 'lib/zm/client/soap_request/soap_context.rb', line 14

def token(str)
  @token = str
  self
end

#user_agent(str) ⇒ Object



19
20
21
22
# File 'lib/zm/client/soap_request/soap_context.rb', line 19

def user_agent(str)
  @user_agent = str
  self
end