Sha256: 3053364363963ee0e4bd8635a71a4ca2f47a5fbad8f9976941ca220f06e8eb09

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

# module ExpressPigeon
#   module API
#     class Messages
#       include ExpressPigeon::API
#
#       def initialize
#         @endpoint = 'messages'
#       end
#
#       def send_message(template_id, to, reply_to, from_name, subject, merge_fields = nil, view_online = false, click_tracking = true)
#         post @endpoint, params = { template_id: template_id,
#                                    to: to,
#                                    reply_to: reply_to,
#                                    from: from_name,
#                                    subject: subject,
#                                    merge_fields: merge_fields,
#                                    view_online: view_online,
#                                    click_tracking: click_tracking
#         }
#       end
#
#       def report(message_id)
#         get "#{@endpoint}/#{message_id}"
#       end
#
#       def reports(from_id, start_date = nil, end_date = nil)
#         params = []
#
#         if from_id
#           params << "from_id=#{from_id}"
#         end
#
#         if start_date && !end_date
#           fail 'must include both start_date and end_date'
#         end
#         if end_date && !start_date
#           fail 'must include both start_date and end_date'
#         end
#
#         if start_date && end_date
#           params << "start_date=#{start_date.strftime('%FT%T.%L%z')}"
#           params << "end_date=#{end_date.strftime('%FT%T.%L%z')}"
#         end
#
#         query = "#{@endpoint}?"
#
#         if params.size > 0
#           query << params.join('&')
#         end
#
#         puts "calling: #{query}"
#         get query
#       end
#     end
#   end
# end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
express_pigeon-2.0.2 lib/express_pigeon/api/messages.rb
express_pigeon-2.0.1 lib/express_pigeon/api/messages.rb
express_pigeon-2.0.0 lib/express_pigeon/api/messages.rb