Module: MarketingCloudSDK::Targeting

Includes:
HTTPRequest
Included in:
Rest, Soap
Defined in:
lib/marketingcloudsdk/targeting.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HTTPRequest

#generate_uri, #request

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



40
41
42
# File 'lib/marketingcloudsdk/targeting.rb', line 40

def access_token
  @access_token
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



41
42
43
# File 'lib/marketingcloudsdk/targeting.rb', line 41

def endpoint
  @endpoint
end

#soap_endpointObject (readonly)

Returns the value of attribute soap_endpoint.



41
42
43
# File 'lib/marketingcloudsdk/targeting.rb', line 41

def soap_endpoint
  @soap_endpoint
end

Instance Method Details

#cache_fileObject



45
46
47
# File 'lib/marketingcloudsdk/targeting.rb', line 45

def cache_file
  'soap_cache_file.json'
end

#get_soap_endpoint_from_fileObject



56
57
58
59
60
61
62
63
64
65
# File 'lib/marketingcloudsdk/targeting.rb', line 56

def get_soap_endpoint_from_file
  data_hash = nil

  if File.exist? cache_file
    file = File.read(cache_file)
    data_hash = JSON.parse(file)
  end

  data_hash
end

#set_soap_endpoint_to_file(url) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'lib/marketingcloudsdk/targeting.rb', line 67

def set_soap_endpoint_to_file url
  data_hash = {
      'url' => url,
      'timestamp' => Time.new.to_f + (10 * 60)
  }

  File.open(cache_file, 'w') do |f|
    f.write(JSON.generate(data_hash))
  end
end