Class: Hominid::Helper

Inherits:
Base
  • Object
show all
Defined in:
lib/hominid/helper.rb

Constant Summary

Constants inherited from Base

Base::MAILCHIMP_API_VERSION

Class Method Summary collapse

Methods inherited from Base

#add_api_key, #api_keys, #apply_defaults_to, #call, #clean_merge_tags, #expire_api_key, #initialize

Constructor Details

This class inherits a constructor from Hominid::Base

Class Method Details

.account_details(options = {}) ⇒ Object

Helper methods




8
9
10
11
# File 'lib/hominid/helper.rb', line 8

def self.(options = {})
  # Get details for this account.
  new(options).call("getAccountDetails")
end

.convert_css_to_inline(html, strip_css = false, options = {}) ⇒ Object



13
14
15
16
# File 'lib/hominid/helper.rb', line 13

def self.convert_css_to_inline(html, strip_css = false, options = {})
  # Convert CSS styles to inline styles and (optionally) remove original styles
  new.call("inlineCss", html, strip_css)
end

.create_folder(name, options = {}) ⇒ Object



18
19
20
21
# File 'lib/hominid/helper.rb', line 18

def self.create_folder(name, options = {})
  # Create a new folder to file campaigns in
  new(options).call("createFolder", name)
end

.generate_text(type, content, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/hominid/helper.rb', line 23

def self.generate_text(type, content, options = {})
  # Have HTML content auto-converted to a text-only format.
  # The options for text type are:
  #   'html'      => Expects a string of HTML(default).
  #   'template'  => Expects an array.
  #   'url'       => Expects a valid and public URL.
  #   'cid'       => Expects a campaign ID.
  #   'tid'       => Expects a template ID.
  new(options).call("generateText", type, content)
end

.html_to_text(content, options = {}) ⇒ Object



34
35
36
37
# File 'lib/hominid/helper.rb', line 34

def self.html_to_text(content, options = {})
  # Convert HTML content to text
  new(options).call("generateText", 'html', content)
end

.ping(options = {}) ⇒ Object



39
40
41
42
# File 'lib/hominid/helper.rb', line 39

def self.ping(options = {})
  # Ping the Mailchimp API
  new(options).call("ping")
end