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
13
# File 'lib/zm/client/soap_request/soap_context.rb', line 8

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

Instance Method Details

#account(by, value) ⇒ Object



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

def (by, value)
  @account = { by: by, _content: value }
  self
end

#target_server(str) ⇒ Object



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

def target_server(str)
  @target_server = str
  self
end

#to_hashObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/zm/client/soap_request/soap_context.rb', line 35

def to_hash
  h = {
    authToken: @token,
    userAgent: { name: @user_agent },
    account: @account,
    targetServer: @target_server
  }
  h.compact!
  h
end

#token(str) ⇒ Object



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

def token(str)
  @token = str
  self
end

#user_agent(str) ⇒ Object



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

def user_agent(str)
  @user_agent = str
  self
end