Module: CampaignMonitor::Helpers
- Included in:
- CampaignMonitor, Campaign, Client, List, Subscriber
- Defined in:
- lib/campaign_monitor/helpers.rb
Instance Method Summary collapse
- #formatted_timestamp(datetime, format = timestamp_format) ⇒ Object
- #handle_response(response) ⇒ Object
- #timestamp_format ⇒ Object
Instance Method Details
#formatted_timestamp(datetime, format = timestamp_format) ⇒ Object
20 21 22 |
# File 'lib/campaign_monitor/helpers.rb', line 20 def (datetime, format=) datetime.strftime(format) end |
#handle_response(response) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/campaign_monitor/helpers.rb', line 4 def handle_response(response) return [] if response.empty? if response["Code"].to_i == 0 # success! yield(response) else # error! raise response["Code"] + " - " + response["Message"] end end |
#timestamp_format ⇒ Object
16 17 18 |
# File 'lib/campaign_monitor/helpers.rb', line 16 def '%Y-%m-%d %H:%M:%S' end |