From 3cc7297376f5aa043850927658f4803a61a6a48c Mon Sep 17 00:00:00 2001 From: rbin Date: Tue, 10 Jun 2014 14:57:22 +0100 Subject: [PATCH] Placeholders && Initialisers --- README.md | 19 +++++++++++++++++++ lib/sendgrid.rb | 2 ++ lib/sendgrid/mail.rb | 43 ++++++++++++++----------------------------- sendgrid-ruby.gemspec | 1 + 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 86874c62..90876202 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,22 @@ +Contributors: + + + + # Sendgrid::Ruby TODO: Write a gem description diff --git a/lib/sendgrid.rb b/lib/sendgrid.rb index f4f44467..8b13fc8a 100644 --- a/lib/sendgrid.rb +++ b/lib/sendgrid.rb @@ -1,3 +1,5 @@ +require "faraday" + module SendGrid class Client diff --git a/lib/sendgrid/mail.rb b/lib/sendgrid/mail.rb index 8f4d5e5a..049458eb 100644 --- a/lib/sendgrid/mail.rb +++ b/lib/sendgrid/mail.rb @@ -3,30 +3,30 @@ module SendGrid class Mail - def initialize() - @endpoint = "/api/mail.send.json?" + def initialize(to) + @endpoint = "/api/mail.send.json" end - attr_reader :to_email, + attr_accessor :endpoint, :to, :from, :subject, :text def add_to(to_email) - #add stuff + @to = to_email end def add_tos(to_emails = {}) - #add stuff + @tos = Array.new(10) { iii } end - def add_to_name(name) + def add_to_name(to_name) #add stuff end - def add_to_names(names = {}) + def add_to_names(to_names = {}) #add stuff end def set_from(from_email) - #add stuff + @from = from_email end def set_from_email(from_name) @@ -34,20 +34,20 @@ def set_from_email(from_name) end def set_subject(subject) - #add stuff + @subject = subject end - def set_text(text, format) - #add stuff + def set_text(text) + @text = text end - def set_html(html, something = {}, inject(Array.new) { |arr, a| arr.push(*a) }) + def set_html(html) #add stuff end - def set_x_smtpapi(json{}) + # def set_x_smtpapi(json{}) - end + # end def add_bcc(bcc) #add stuff @@ -79,18 +79,3 @@ def add_headers(headers = {}) end end - - - - -## - ## THIS IS HOW I WANNA USE IT. - # sg = sendgrid.Client.new("Myuser", "Mykey") - # m = sendgrid.Mail.new() - # m.add_to("robin@sendgrid.com") - # sg.send(m) - - ## OR - - # m = sendgrid.Mail.new(:to => "me@rbin.co", :from => "tits@mcgee.me") - # sg.send(m) \ No newline at end of file diff --git a/sendgrid-ruby.gemspec b/sendgrid-ruby.gemspec index 861a3ad7..0bd27d2a 100644 --- a/sendgrid-ruby.gemspec +++ b/sendgrid-ruby.gemspec @@ -13,6 +13,7 @@ Gem::Specification.new do |gem| gem.email = 'rbin@sendgrid.com' gem.homepage = 'http://github.com/sendgrid/sendgrid-ruby' + gem.add_development_dependency "faraday" gem.add_development_dependency "rake" gem.add_development_dependency "rspec" gem.add_development_dependency "rspec-nc"