Module: TFSO::Helpers

Included in:
Authentication, Client, Company, Invoice, Payment, Person, Product
Defined in:
lib/tfso/helpers.rb

Instance Method Summary collapse

Instance Method Details

#ensure_authenticated(auth) ⇒ Object



14
15
16
# File 'lib/tfso/helpers.rb', line 14

def ensure_authenticated(auth)
  auth.authenticated?
end

#intialize_savon_clientObject



5
6
7
8
9
10
11
12
# File 'lib/tfso/helpers.rb', line 5

def intialize_savon_client
  @savon_client = Savon.client(wsdl: self.class::URL, convert_request_keys_to: :none)
  if ENV['RACK_ENV'] == 'test' || defined?(Rails) && Rails.env.development?
    @savon_client.globals.proxy('http://localhost:8080')
    @savon_client.globals.ssl_verify_mode(:none)
  end
  @savon_client.globals.unwrap(true)
end

#savon_clientObject



18
19
20
# File 'lib/tfso/helpers.rb', line 18

def savon_client
  @savon_client
end

#session_idObject



22
23
24
# File 'lib/tfso/helpers.rb', line 22

def session_id
  @session_id
end

#session_id=(session_id) ⇒ Object



26
27
28
29
# File 'lib/tfso/helpers.rb', line 26

def session_id=(session_id)
  @session_id = session_id
  @cookies = [HTTPI::Cookie.new("ASP.NET_SessionId=#{@session_id}")]
end