Class: Velocify::AddLeadsPayload
- Inherits:
-
Object
- Object
- Velocify::AddLeadsPayload
- Includes:
- ERB::Util
- Defined in:
- lib/velocify/payload.rb
Instance Method Summary collapse
-
#authenticate(username:, password:) ⇒ Hash
Stores credentials for making an authenticated request.
-
#initialize(leads) ⇒ AddLeadsPayload
constructor
Creates a new request to add leads.
-
#render ⇒ String
The XML payload to send to Velocify’s AddLeads operation.
Constructor Details
#initialize(leads) ⇒ AddLeadsPayload
Creates a new request to add leads
24 25 26 27 |
# File 'lib/velocify/payload.rb', line 24 def initialize leads @leads = leads @credentials = {} end |
Instance Method Details
#authenticate(username:, password:) ⇒ Hash
Stores credentials for making an authenticated request
34 35 36 |
# File 'lib/velocify/payload.rb', line 34 def authenticate username:, password: @credentials = Hash[:username, username, :password, password] end |
#render ⇒ String
Returns The XML payload to send to Velocify’s AddLeads operation.
39 40 41 42 43 44 45 46 |
# File 'lib/velocify/payload.rb', line 39 def render relative_path = File.join '..', '..', 'templates', 'add_leads.xml.erb' current_dir = File.dirname(__FILE__) path = File. relative_path, current_dir template = File.read(path) xml_str = ERB.new(template).result binding { xml: xml_str.gsub(/[\n\t]*/, '').gsub(/[ ]{2,}/, '') } end |