sendgrid-api 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -2
 - data/.yardopts +6 -0
 - data/Gemfile +2 -0
 - data/Gemfile.lock +5 -1
 - data/README.md +200 -12
 - data/Rakefile +3 -0
 - data/lib/sendgrid/api/client.rb +16 -0
 - data/lib/sendgrid/api/entities/category.rb +13 -0
 - data/lib/sendgrid/api/entities/email.rb +13 -0
 - data/lib/sendgrid/api/entities/entity.rb +2 -2
 - data/lib/sendgrid/api/entities/list.rb +30 -0
 - data/lib/sendgrid/api/entities/marketing_email.rb +20 -0
 - data/lib/sendgrid/api/entities/response_insert.rb +23 -0
 - data/lib/sendgrid/api/entities/response_remove.rb +23 -0
 - data/lib/sendgrid/api/entities/schedule.rb +13 -0
 - data/lib/sendgrid/api/entities/sender_address.rb +13 -0
 - data/lib/sendgrid/api/newsletter/categories.rb +74 -0
 - data/lib/sendgrid/api/newsletter/emails.rb +69 -0
 - data/lib/sendgrid/api/newsletter/lists.rb +64 -0
 - data/lib/sendgrid/api/newsletter/marketing_emails.rb +72 -0
 - data/lib/sendgrid/api/newsletter/recipients.rb +55 -0
 - data/lib/sendgrid/api/newsletter/schedule.rb +70 -0
 - data/lib/sendgrid/api/newsletter/sender_addresses.rb +80 -0
 - data/lib/sendgrid/api/newsletter/utils.rb +34 -0
 - data/lib/sendgrid/api/rest/errors/error.rb +9 -3
 - data/lib/sendgrid/api/rest/resource.rb +3 -1
 - data/lib/sendgrid/api/version.rb +1 -1
 - data/lib/sendgrid/api/web/mail.rb +44 -0
 - data/lib/sendgrid/api/web/profile.rb +3 -3
 - data/lib/sendgrid/api/web/stats.rb +3 -3
 - data/spec/fixtures/categories.json +11 -0
 - data/spec/fixtures/emails/email.json +6 -0
 - data/spec/fixtures/emails/emails.json +10 -0
 - data/spec/fixtures/errors/already_exists.json +3 -0
 - data/spec/fixtures/errors/bad_request.json +6 -0
 - data/spec/fixtures/errors/database_error.json +3 -0
 - data/spec/fixtures/errors/does_not_exist.json +3 -0
 - data/spec/fixtures/{forbidden.json → errors/forbidden.json} +0 -0
 - data/spec/fixtures/errors/invalid_fields.json +3 -0
 - data/spec/fixtures/errors/not_scheduled.json +3 -0
 - data/spec/fixtures/errors/unauthorized.json +6 -0
 - data/spec/fixtures/lists/list.json +5 -0
 - data/spec/fixtures/lists/lists.json +11 -0
 - data/spec/fixtures/marketing_emails/marketing_email.json +19 -0
 - data/spec/fixtures/marketing_emails/marketing_emails.json +10 -0
 - data/spec/fixtures/recipients.json +8 -0
 - data/spec/fixtures/schedule.json +3 -0
 - data/spec/fixtures/sender_addresses/sender_address.json +11 -0
 - data/spec/fixtures/sender_addresses/sender_addresses.json +11 -0
 - data/spec/sendgrid/api/client_spec.rb +16 -0
 - data/spec/sendgrid/api/entities/category_spec.rb +14 -0
 - data/spec/sendgrid/api/entities/email_spec.rb +15 -0
 - data/spec/sendgrid/api/entities/list_spec.rb +34 -0
 - data/spec/sendgrid/api/entities/marketing_email_spec.rb +31 -0
 - data/spec/sendgrid/api/entities/response_insert_spec.rb +28 -0
 - data/spec/sendgrid/api/entities/response_remove_spec.rb +28 -0
 - data/spec/sendgrid/api/entities/schedule_spec.rb +14 -0
 - data/spec/sendgrid/api/entities/sender_address_spec.rb +21 -0
 - data/spec/sendgrid/api/newsletter/categories_spec.rb +247 -0
 - data/spec/sendgrid/api/newsletter/emails_spec.rb +265 -0
 - data/spec/sendgrid/api/newsletter/lists_spec.rb +307 -0
 - data/spec/sendgrid/api/newsletter/marketing_emails_spec.rb +306 -0
 - data/spec/sendgrid/api/newsletter/recipients_spec.rb +252 -0
 - data/spec/sendgrid/api/newsletter/schedule_spec.rb +263 -0
 - data/spec/sendgrid/api/newsletter/sender_addresses_spec.rb +300 -0
 - data/spec/sendgrid/api/rest/errors/error_spec.rb +40 -16
 - data/spec/sendgrid/api/rest/resource_spec.rb +2 -0
 - data/spec/sendgrid/api/web/mail_spec.rb +111 -0
 - data/spec/sendgrid/api/web/profile_spec.rb +13 -29
 - data/spec/sendgrid/api/web/stats_spec.rb +9 -15
 - data/spec/support/helpers.rb +8 -0
 - data/spec/support/mock.rb +6 -2
 - data/spec/support/online.rb +114 -0
 - data/spec/support/shared_examples.rb +93 -0
 - metadata +96 -10
 - data/spec/fixtures/unauthorized.json +0 -6
 
| 
         @@ -15,15 +15,15 @@ module Sendgrid 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                      describe '#get' do
         
     | 
| 
       17 
17 
     | 
    
         
             
                        let(:url) { 'profile.get.json' }
         
     | 
| 
      
 18 
     | 
    
         
            +
                        let(:stub_post) { sg_mock.stub_post(url) }
         
     | 
| 
      
 19 
     | 
    
         
            +
                        subject { service.get }
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
21 
     | 
    
         
             
                        context 'when request is successfull' do
         
     | 
| 
       20 
22 
     | 
    
         
             
                          before do
         
     | 
| 
       21 
     | 
    
         
            -
                             
     | 
| 
      
 23 
     | 
    
         
            +
                            stub_post.to_return(:body => fixture('profile.json'))
         
     | 
| 
       22 
24 
     | 
    
         
             
                          end
         
     | 
| 
       23 
25 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                           
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                          it 'should perform the request' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                          it 'performs the request' do
         
     | 
| 
       27 
27 
     | 
    
         
             
                            subject
         
     | 
| 
       28 
28 
     | 
    
         
             
                            sg_mock.a_post(url).should have_been_made
         
     | 
| 
       29 
29 
     | 
    
         
             
                          end
         
     | 
| 
         @@ -47,38 +47,22 @@ module Sendgrid 
     | 
|
| 
       47 
47 
     | 
    
         
             
                        end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
                        context 'when permission failed' do
         
     | 
| 
       50 
     | 
    
         
            -
                           
     | 
| 
       51 
     | 
    
         
            -
                            sg_mock.stub_post(url).to_return(:body => fixture('unauthorized.json'))
         
     | 
| 
       52 
     | 
    
         
            -
                          end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                          it 'should raise error' do
         
     | 
| 
       55 
     | 
    
         
            -
                            expect { service.get }.to raise_error(REST::Errors::Unauthorized)
         
     | 
| 
       56 
     | 
    
         
            -
                          end
         
     | 
| 
      
 50 
     | 
    
         
            +
                          it_behaves_like 'an unauthorized response'
         
     | 
| 
       57 
51 
     | 
    
         
             
                        end
         
     | 
| 
       58 
52 
     | 
    
         
             
                      end
         
     | 
| 
       59 
53 
     | 
    
         | 
| 
       60 
54 
     | 
    
         
             
                      describe '#set' do
         
     | 
| 
       61 
55 
     | 
    
         
             
                        let(:url) { 'profile.set.json' }
         
     | 
| 
       62 
56 
     | 
    
         
             
                        let(:profile) { Entities::Profile.new(:first_name => 'Brian', :last_name => 'O\'Neill') }
         
     | 
| 
      
 57 
     | 
    
         
            +
                        let(:stub_post) { sg_mock.stub_post(url, profile.as_json) }
         
     | 
| 
      
 58 
     | 
    
         
            +
                        subject { service.set(profile) }
         
     | 
| 
       63 
59 
     | 
    
         | 
| 
       64 
60 
     | 
    
         
             
                        context 'when request is successfull' do
         
     | 
| 
       65 
     | 
    
         
            -
                           
     | 
| 
       66 
     | 
    
         
            -
                            sg_mock.stub_post(url, profile.as_json).to_return(:body => fixture('success.json'))
         
     | 
| 
       67 
     | 
    
         
            -
                          end
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                          subject { service.set(profile) }
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                          its(:success?) { should be_true }
         
     | 
| 
      
 61 
     | 
    
         
            +
                          it_behaves_like 'a success response'
         
     | 
| 
       72 
62 
     | 
    
         
             
                        end
         
     | 
| 
       73 
63 
     | 
    
         | 
| 
       74 
64 
     | 
    
         
             
                        context 'when permission failed' do
         
     | 
| 
       75 
     | 
    
         
            -
                           
     | 
| 
       76 
     | 
    
         
            -
                            sg_mock.stub_post(url, profile.as_json).to_return(:body => fixture('unauthorized.json'))
         
     | 
| 
       77 
     | 
    
         
            -
                          end
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                          it 'should raise error' do
         
     | 
| 
       80 
     | 
    
         
            -
                            expect { service.set(profile) }.to raise_error(REST::Errors::Unauthorized)
         
     | 
| 
       81 
     | 
    
         
            -
                          end
         
     | 
| 
      
 65 
     | 
    
         
            +
                          it_behaves_like 'an unauthorized response'
         
     | 
| 
       82 
66 
     | 
    
         
             
                        end
         
     | 
| 
       83 
67 
     | 
    
         
             
                      end
         
     | 
| 
       84 
68 
     | 
    
         | 
| 
         @@ -89,13 +73,13 @@ module Sendgrid 
     | 
|
| 
       89 
73 
     | 
    
         
             
                          let(:resource) { REST::Resource.new(env_user, env_key) }
         
     | 
| 
       90 
74 
     | 
    
         | 
| 
       91 
75 
     | 
    
         
             
                          describe '#get' do
         
     | 
| 
       92 
     | 
    
         
            -
                            it ' 
     | 
| 
      
 76 
     | 
    
         
            +
                            it 'gets profile' do
         
     | 
| 
       93 
77 
     | 
    
         
             
                              subject.get.should be_instance_of(Entities::Profile)
         
     | 
| 
       94 
78 
     | 
    
         
             
                            end
         
     | 
| 
       95 
79 
     | 
    
         
             
                          end
         
     | 
| 
       96 
80 
     | 
    
         | 
| 
       97 
81 
     | 
    
         
             
                          describe '#set' do
         
     | 
| 
       98 
     | 
    
         
            -
                            it ' 
     | 
| 
      
 82 
     | 
    
         
            +
                            it 'updates profile' do
         
     | 
| 
       99 
83 
     | 
    
         
             
                              profile = subject.get
         
     | 
| 
       100 
84 
     | 
    
         
             
                              subject.set(profile).success?.should be_true
         
     | 
| 
       101 
85 
     | 
    
         
             
                            end
         
     | 
| 
         @@ -104,7 +88,7 @@ module Sendgrid 
     | 
|
| 
       104 
88 
     | 
    
         | 
| 
       105 
89 
     | 
    
         
             
                        context 'when credentials are invalid' do
         
     | 
| 
       106 
90 
     | 
    
         
             
                          describe '#get' do
         
     | 
| 
       107 
     | 
    
         
            -
                            it ' 
     | 
| 
      
 91 
     | 
    
         
            +
                            it 'raises error' do
         
     | 
| 
       108 
92 
     | 
    
         
             
                              expect { subject.get }.to raise_error(REST::Errors::Unauthorized)
         
     | 
| 
       109 
93 
     | 
    
         
             
                            end
         
     | 
| 
       110 
94 
     | 
    
         
             
                          end
         
     | 
| 
         @@ -112,7 +96,7 @@ module Sendgrid 
     | 
|
| 
       112 
96 
     | 
    
         
             
                          describe '#set' do
         
     | 
| 
       113 
97 
     | 
    
         
             
                            let(:profile) { Entities::Profile.new(:first_name => 'Brian', :last_name => 'O\'Neill') }
         
     | 
| 
       114 
98 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
                            it ' 
     | 
| 
      
 99 
     | 
    
         
            +
                            it 'raises error' do
         
     | 
| 
       116 
100 
     | 
    
         
             
                              expect { subject.set(profile) }.to raise_error(REST::Errors::Unauthorized)
         
     | 
| 
       117 
101 
     | 
    
         
             
                            end
         
     | 
| 
       118 
102 
     | 
    
         
             
                          end
         
     | 
| 
         @@ -15,15 +15,15 @@ module Sendgrid 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                      describe '#advanced' do
         
     | 
| 
       17 
17 
     | 
    
         
             
                        let(:url) { 'stats.getAdvanced.json' }
         
     | 
| 
      
 18 
     | 
    
         
            +
                        let(:stub_post) { sg_mock.stub_post(url) }
         
     | 
| 
      
 19 
     | 
    
         
            +
                        subject { service.advanced }
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
21 
     | 
    
         
             
                        context 'when request is successfull' do
         
     | 
| 
       20 
22 
     | 
    
         
             
                          before do
         
     | 
| 
       21 
     | 
    
         
            -
                             
     | 
| 
      
 23 
     | 
    
         
            +
                            stub_post.to_return(:body => fixture('stats.json'))
         
     | 
| 
       22 
24 
     | 
    
         
             
                          end
         
     | 
| 
       23 
25 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                           
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                          it 'should perform the request' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                          it 'performs the request' do
         
     | 
| 
       27 
27 
     | 
    
         
             
                            subject
         
     | 
| 
       28 
28 
     | 
    
         
             
                            sg_mock.a_post(url).should have_been_made
         
     | 
| 
       29 
29 
     | 
    
         
             
                          end
         
     | 
| 
         @@ -43,20 +43,14 @@ module Sendgrid 
     | 
|
| 
       43 
43 
     | 
    
         
             
                            its(:deferred) { should == 1975 }
         
     | 
| 
       44 
44 
     | 
    
         
             
                            its(:processed) { should == 5302 }
         
     | 
| 
       45 
45 
     | 
    
         
             
                            its(:date) { should == '2013-06-18' }
         
     | 
| 
       46 
     | 
    
         
            -
                            its(:open) { pending(' 
     | 
| 
      
 46 
     | 
    
         
            +
                            its(:open) { pending('debugs open method') }
         
     | 
| 
       47 
47 
     | 
    
         
             
                            its(:click) { should == 11 }
         
     | 
| 
       48 
48 
     | 
    
         
             
                            its(:blocked) { should == 29 }
         
     | 
| 
       49 
49 
     | 
    
         
             
                          end
         
     | 
| 
       50 
50 
     | 
    
         
             
                        end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                        context 'when permission failed' do
         
     | 
| 
       53 
     | 
    
         
            -
                           
     | 
| 
       54 
     | 
    
         
            -
                            sg_mock.stub_post(url).to_return(:body => fixture('forbidden.json'), :status => 403)
         
     | 
| 
       55 
     | 
    
         
            -
                          end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                          it 'should raise error' do
         
     | 
| 
       58 
     | 
    
         
            -
                            expect { service.advanced }.to raise_error(REST::Errors::Forbidden)
         
     | 
| 
       59 
     | 
    
         
            -
                          end
         
     | 
| 
      
 53 
     | 
    
         
            +
                          it_behaves_like 'a forbidden response'
         
     | 
| 
       60 
54 
     | 
    
         
             
                        end
         
     | 
| 
       61 
55 
     | 
    
         
             
                      end
         
     | 
| 
       62 
56 
     | 
    
         | 
| 
         @@ -71,13 +65,13 @@ module Sendgrid 
     | 
|
| 
       71 
65 
     | 
    
         
             
                              # 90 days from now
         
     | 
| 
       72 
66 
     | 
    
         
             
                              let(:start_date) { (Time.now - (90*24*60*60)).strftime("%Y-%m-%d") }
         
     | 
| 
       73 
67 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                              it ' 
     | 
| 
      
 68 
     | 
    
         
            +
                              it 'gets stats' do
         
     | 
| 
       75 
69 
     | 
    
         
             
                                subject.advanced(:start_date => start_date, :data_type => :global).should_not be_empty
         
     | 
| 
       76 
70 
     | 
    
         
             
                              end
         
     | 
| 
       77 
71 
     | 
    
         
             
                            end
         
     | 
| 
       78 
72 
     | 
    
         | 
| 
       79 
73 
     | 
    
         
             
                            context 'without required params' do
         
     | 
| 
       80 
     | 
    
         
            -
                              it ' 
     | 
| 
      
 74 
     | 
    
         
            +
                              it 'raises error' do
         
     | 
| 
       81 
75 
     | 
    
         
             
                                expect { subject.advanced }.to raise_error(REST::Errors::BadRequest)
         
     | 
| 
       82 
76 
     | 
    
         
             
                              end
         
     | 
| 
       83 
77 
     | 
    
         
             
                            end
         
     | 
| 
         @@ -86,7 +80,7 @@ module Sendgrid 
     | 
|
| 
       86 
80 
     | 
    
         | 
| 
       87 
81 
     | 
    
         
             
                        context 'when credentials are invalid' do
         
     | 
| 
       88 
82 
     | 
    
         
             
                          describe '#advanced' do
         
     | 
| 
       89 
     | 
    
         
            -
                            it ' 
     | 
| 
      
 83 
     | 
    
         
            +
                            it 'raises error' do
         
     | 
| 
       90 
84 
     | 
    
         
             
                              expect { subject.advanced }.to raise_error(REST::Errors::Forbidden)
         
     | 
| 
       91 
85 
     | 
    
         
             
                            end
         
     | 
| 
       92 
86 
     | 
    
         
             
                          end
         
     | 
    
        data/spec/support/helpers.rb
    CHANGED
    
    | 
         @@ -12,4 +12,12 @@ end 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            def disable_http
         
     | 
| 
       14 
14 
     | 
    
         
             
              WebMock.disable_net_connect!(:allow => 'coveralls.io')
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            def sample_file(options = {})
         
     | 
| 
      
 18 
     | 
    
         
            +
              name = options[:name] || 'sample.txt'
         
     | 
| 
      
 19 
     | 
    
         
            +
              type = options[:type] || 'plain/text'
         
     | 
| 
      
 20 
     | 
    
         
            +
              content = options[:content] || 'This is my file content'
         
     | 
| 
      
 21 
     | 
    
         
            +
              stream = StringIO.new(content)
         
     | 
| 
      
 22 
     | 
    
         
            +
              Faraday::UploadIO.new(stream, type, name)
         
     | 
| 
       15 
23 
     | 
    
         
             
            end
         
     | 
    
        data/spec/support/mock.rb
    CHANGED
    
    | 
         @@ -8,15 +8,19 @@ module Sendgrid 
     | 
|
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                def stub_post(path, params = {})
         
     | 
| 
       11 
     | 
    
         
            -
                  stub_request(:post,  
     | 
| 
      
 11 
     | 
    
         
            +
                  stub_request(:post, uri(path)).
         
     | 
| 
       12 
12 
     | 
    
         
             
                    with(:body => params.merge(authentication_params))
         
     | 
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                def a_post(path, params = {})
         
     | 
| 
       16 
     | 
    
         
            -
                  a_request(:post,  
     | 
| 
      
 16 
     | 
    
         
            +
                  a_request(:post, uri(path)).
         
     | 
| 
       17 
17 
     | 
    
         
             
                    with(:body => params.merge(authentication_params))
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
      
 20 
     | 
    
         
            +
                def uri(path)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  Sendgrid::API::REST::Resource::ENDPOINT + '/' + path
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       20 
24 
     | 
    
         
             
                private
         
     | 
| 
       21 
25 
     | 
    
         | 
| 
       22 
26 
     | 
    
         
             
                def authentication_params
         
     | 
| 
         @@ -0,0 +1,114 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Online
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              attr_reader :client
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              def initialize(user, key)
         
     | 
| 
      
 6 
     | 
    
         
            +
                @client = Sendgrid::API::Client.new(user, key)
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def sender_address_example
         
     | 
| 
      
 10 
     | 
    
         
            +
                Sendgrid::API::Entities::SenderAddress.new(
         
     | 
| 
      
 11 
     | 
    
         
            +
                  :identity => 'sendgrid-api sender address test',
         
     | 
| 
      
 12 
     | 
    
         
            +
                  :name     => 'Sendgrid',
         
     | 
| 
      
 13 
     | 
    
         
            +
                  :email    => 'contact@sendgrid.com',
         
     | 
| 
      
 14 
     | 
    
         
            +
                  :address  => '1065 N Pacificenter Drive, Suite 425',
         
     | 
| 
      
 15 
     | 
    
         
            +
                  :city     => 'Anaheim',
         
     | 
| 
      
 16 
     | 
    
         
            +
                  :state    => 'CA',
         
     | 
| 
      
 17 
     | 
    
         
            +
                  :zip      => '92806',
         
     | 
| 
      
 18 
     | 
    
         
            +
                  :country  => 'US'
         
     | 
| 
      
 19 
     | 
    
         
            +
                )
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              def marketing_email_example
         
     | 
| 
      
 23 
     | 
    
         
            +
                identity = sender_address_example.identity
         
     | 
| 
      
 24 
     | 
    
         
            +
                Sendgrid::API::Entities::MarketingEmail.new(
         
     | 
| 
      
 25 
     | 
    
         
            +
                  :identity => identity, 
         
     | 
| 
      
 26 
     | 
    
         
            +
                  :name     => 'sendgrid-api marketing email test', 
         
     | 
| 
      
 27 
     | 
    
         
            +
                  :subject  => 'My Marketing Email Test', 
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :text     => 'My text', 
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :html     => 'My HTML'
         
     | 
| 
      
 30 
     | 
    
         
            +
                )
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              def category_example
         
     | 
| 
      
 34 
     | 
    
         
            +
                Sendgrid::API::Entities::Category.new(
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :category => 'sendgrid-api test'
         
     | 
| 
      
 36 
     | 
    
         
            +
                )
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              def list_example
         
     | 
| 
      
 40 
     | 
    
         
            +
                Sendgrid::API::Entities::List.new(
         
     | 
| 
      
 41 
     | 
    
         
            +
                  :list => 'sendgrid-api list test'
         
     | 
| 
      
 42 
     | 
    
         
            +
                )
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              def emails_example
         
     | 
| 
      
 46 
     | 
    
         
            +
                [
         
     | 
| 
      
 47 
     | 
    
         
            +
                  Sendgrid::API::Entities::Email.new(:email => 'john@example.com', :name => 'John'),
         
     | 
| 
      
 48 
     | 
    
         
            +
                  Sendgrid::API::Entities::Email.new(:email => 'brian@example.com', :name => 'Brian')
         
     | 
| 
      
 49 
     | 
    
         
            +
                ]
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              def add_marketing_email
         
     | 
| 
      
 53 
     | 
    
         
            +
                client.sender_addresses.add(sender_address_example)
         
     | 
| 
      
 54 
     | 
    
         
            +
                client.marketing_emails.add(marketing_email_example)
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              def delete_marketing_email
         
     | 
| 
      
 58 
     | 
    
         
            +
                client.marketing_emails.delete(marketing_email_example)
         
     | 
| 
      
 59 
     | 
    
         
            +
                client.sender_addresses.delete(sender_address_example)
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              def add_list
         
     | 
| 
      
 63 
     | 
    
         
            +
                client.lists.add(list_example)
         
     | 
| 
      
 64 
     | 
    
         
            +
                client.emails.add(list_example, emails_example)
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              def delete_list
         
     | 
| 
      
 68 
     | 
    
         
            +
                client.lists.delete(list_example)
         
     | 
| 
      
 69 
     | 
    
         
            +
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              def add_recipient_list
         
     | 
| 
      
 72 
     | 
    
         
            +
                check_completed do
         
     | 
| 
      
 73 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 74 
     | 
    
         
            +
                    client.recipients.add(list_example, marketing_email_example).success? 
         
     | 
| 
      
 75 
     | 
    
         
            +
                  rescue Sendgrid::API::REST::Errors::UnprocessableEntity
         
     | 
| 
      
 76 
     | 
    
         
            +
                    false
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
              def add_marketing_email_with_list
         
     | 
| 
      
 82 
     | 
    
         
            +
                add_marketing_email
         
     | 
| 
      
 83 
     | 
    
         
            +
                add_list
         
     | 
| 
      
 84 
     | 
    
         
            +
                add_recipient_list
         
     | 
| 
      
 85 
     | 
    
         
            +
              end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
              def delete_marketing_email_with_list
         
     | 
| 
      
 88 
     | 
    
         
            +
                delete_marketing_email
         
     | 
| 
      
 89 
     | 
    
         
            +
                delete_list
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              private
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              # Check if some operation is completed or not.
         
     | 
| 
      
 95 
     | 
    
         
            +
              #
         
     | 
| 
      
 96 
     | 
    
         
            +
              # @see http://support.sendgrid.com/hc/en-us/articles/200185208-SendGrid-Web-API-may-return-successful-but-doesn-t-mean-it-has-completed
         
     | 
| 
      
 97 
     | 
    
         
            +
              # @param timeout [Fixnum] The maximum number of seconds to check the operation status. Default: 60 seconds.
         
     | 
| 
      
 98 
     | 
    
         
            +
              # @param delay [Fixnum] The number of seconds between each check. Default: 3 seconds.
         
     | 
| 
      
 99 
     | 
    
         
            +
              # @param &block [Block] The given block should return true if completed, otherwise false.
         
     | 
| 
      
 100 
     | 
    
         
            +
              # @return [Bool] The operation status
         
     | 
| 
      
 101 
     | 
    
         
            +
              def check_completed(timeout = 60, delay = 3)
         
     | 
| 
      
 102 
     | 
    
         
            +
                start = Time.now
         
     | 
| 
      
 103 
     | 
    
         
            +
                response = nil
         
     | 
| 
      
 104 
     | 
    
         
            +
                loop do
         
     | 
| 
      
 105 
     | 
    
         
            +
                  response = yield
         
     | 
| 
      
 106 
     | 
    
         
            +
                  duration = Time.now - start
         
     | 
| 
      
 107 
     | 
    
         
            +
                  # puts "Checking operation - status: #{response.inspect} - duration: #{duration} seconds"
         
     | 
| 
      
 108 
     | 
    
         
            +
                  break if response || (duration > timeout)
         
     | 
| 
      
 109 
     | 
    
         
            +
                  sleep delay
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
                response
         
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -8,4 +8,97 @@ shared_examples 'online tests' do 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
              let(:env_user)  { ENV['SENDGRID_USER'] }
         
     | 
| 
       10 
10 
     | 
    
         
             
              let(:env_key)   { ENV['SENDGRID_KEY'] }
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            shared_examples 'a success response' do
         
     | 
| 
      
 14 
     | 
    
         
            +
              before do
         
     | 
| 
      
 15 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('success.json'))
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
              its(:success?) { should be_true }
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            shared_examples 'an unauthorized response' do
         
     | 
| 
      
 21 
     | 
    
         
            +
              before do
         
     | 
| 
      
 22 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/unauthorized.json'), :status => 401)
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::Unauthorized)
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            shared_examples 'a forbidden response' do
         
     | 
| 
      
 30 
     | 
    
         
            +
              before do
         
     | 
| 
      
 31 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/forbidden.json'), :status => 403)
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 34 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::Forbidden)
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            shared_examples 'an invalid fields response' do
         
     | 
| 
      
 39 
     | 
    
         
            +
              before do
         
     | 
| 
      
 40 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/invalid_fields.json'), :status => 400)
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::BadRequest)
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            shared_examples 'a does not exist response' do
         
     | 
| 
      
 48 
     | 
    
         
            +
              before do
         
     | 
| 
      
 49 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/does_not_exist.json'), :status => 401)
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 52 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::Unauthorized)
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            shared_examples 'an already exists response' do
         
     | 
| 
      
 57 
     | 
    
         
            +
              before do
         
     | 
| 
      
 58 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/already_exists.json'))
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 62 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::UnprocessableEntity)
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
            end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            shared_examples 'an already exists unauthorized response' do
         
     | 
| 
      
 67 
     | 
    
         
            +
              before do
         
     | 
| 
      
 68 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/already_exists.json'), :status => 401)
         
     | 
| 
      
 69 
     | 
    
         
            +
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 72 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::Unauthorized)
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
            end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            shared_examples 'a database error response' do
         
     | 
| 
      
 77 
     | 
    
         
            +
              before do
         
     | 
| 
      
 78 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/database_error.json'), :status => 500)
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 82 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::Unknown)
         
     | 
| 
      
 83 
     | 
    
         
            +
              end
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            shared_examples 'a not scheduled response' do
         
     | 
| 
      
 87 
     | 
    
         
            +
              before do
         
     | 
| 
      
 88 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/bad_request.json'), :status => 401)
         
     | 
| 
      
 89 
     | 
    
         
            +
              end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 92 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::Unauthorized)
         
     | 
| 
      
 93 
     | 
    
         
            +
              end
         
     | 
| 
      
 94 
     | 
    
         
            +
            end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            shared_examples 'a bad request response' do
         
     | 
| 
      
 97 
     | 
    
         
            +
              before do
         
     | 
| 
      
 98 
     | 
    
         
            +
                stub_post.to_return(:body => fixture('errors/bad_request.json'), :status => 400)
         
     | 
| 
      
 99 
     | 
    
         
            +
              end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
              it 'raises an error' do
         
     | 
| 
      
 102 
     | 
    
         
            +
                expect { subject }.to raise_error(Sendgrid::API::REST::Errors::BadRequest)
         
     | 
| 
      
 103 
     | 
    
         
            +
              end
         
     | 
| 
       11 
104 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sendgrid-api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,11 +9,11 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013-10- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-10-31 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: faraday
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &70315414007340 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: 0.8.8
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *70315414007340
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: json
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &70315414004160 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -32,7 +32,7 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: 1.8.0
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *70315414004160
         
     | 
| 
       36 
36 
     | 
    
         
             
            description: A Ruby interface to the SendGrid API
         
     | 
| 
       37 
37 
     | 
    
         
             
            email:
         
     | 
| 
       38 
38 
     | 
    
         
             
            - renatosnrg@gmail.com
         
     | 
| 
         @@ -43,6 +43,7 @@ files: 
     | 
|
| 
       43 
43 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       44 
44 
     | 
    
         
             
            - .rspec
         
     | 
| 
       45 
45 
     | 
    
         
             
            - .travis.yml
         
     | 
| 
      
 46 
     | 
    
         
            +
            - .yardopts
         
     | 
| 
       46 
47 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       47 
48 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       48 
49 
     | 
    
         
             
            - LICENSE
         
     | 
| 
         @@ -50,40 +51,91 @@ files: 
     | 
|
| 
       50 
51 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       51 
52 
     | 
    
         
             
            - lib/sendgrid/api.rb
         
     | 
| 
       52 
53 
     | 
    
         
             
            - lib/sendgrid/api/client.rb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - lib/sendgrid/api/entities/category.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - lib/sendgrid/api/entities/email.rb
         
     | 
| 
       53 
56 
     | 
    
         
             
            - lib/sendgrid/api/entities/entity.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/sendgrid/api/entities/list.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/sendgrid/api/entities/marketing_email.rb
         
     | 
| 
       54 
59 
     | 
    
         
             
            - lib/sendgrid/api/entities/profile.rb
         
     | 
| 
       55 
60 
     | 
    
         
             
            - lib/sendgrid/api/entities/response.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/sendgrid/api/entities/response_insert.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/sendgrid/api/entities/response_remove.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/sendgrid/api/entities/schedule.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/sendgrid/api/entities/sender_address.rb
         
     | 
| 
       56 
65 
     | 
    
         
             
            - lib/sendgrid/api/entities/stats.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/categories.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/emails.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/lists.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/marketing_emails.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/recipients.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/schedule.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/sender_addresses.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/sendgrid/api/newsletter/utils.rb
         
     | 
| 
       57 
74 
     | 
    
         
             
            - lib/sendgrid/api/rest/errors/error.rb
         
     | 
| 
       58 
75 
     | 
    
         
             
            - lib/sendgrid/api/rest/resource.rb
         
     | 
| 
       59 
76 
     | 
    
         
             
            - lib/sendgrid/api/rest/response/parse_error.rb
         
     | 
| 
       60 
77 
     | 
    
         
             
            - lib/sendgrid/api/rest/response/parse_json.rb
         
     | 
| 
       61 
78 
     | 
    
         
             
            - lib/sendgrid/api/service.rb
         
     | 
| 
       62 
79 
     | 
    
         
             
            - lib/sendgrid/api/version.rb
         
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/sendgrid/api/web/mail.rb
         
     | 
| 
       63 
81 
     | 
    
         
             
            - lib/sendgrid/api/web/profile.rb
         
     | 
| 
       64 
82 
     | 
    
         
             
            - lib/sendgrid/api/web/stats.rb
         
     | 
| 
       65 
83 
     | 
    
         
             
            - sendgrid-api.gemspec
         
     | 
| 
       66 
     | 
    
         
            -
            - spec/fixtures/ 
     | 
| 
      
 84 
     | 
    
         
            +
            - spec/fixtures/categories.json
         
     | 
| 
      
 85 
     | 
    
         
            +
            - spec/fixtures/emails/email.json
         
     | 
| 
      
 86 
     | 
    
         
            +
            - spec/fixtures/emails/emails.json
         
     | 
| 
      
 87 
     | 
    
         
            +
            - spec/fixtures/errors/already_exists.json
         
     | 
| 
      
 88 
     | 
    
         
            +
            - spec/fixtures/errors/bad_request.json
         
     | 
| 
      
 89 
     | 
    
         
            +
            - spec/fixtures/errors/database_error.json
         
     | 
| 
      
 90 
     | 
    
         
            +
            - spec/fixtures/errors/does_not_exist.json
         
     | 
| 
      
 91 
     | 
    
         
            +
            - spec/fixtures/errors/forbidden.json
         
     | 
| 
      
 92 
     | 
    
         
            +
            - spec/fixtures/errors/invalid_fields.json
         
     | 
| 
      
 93 
     | 
    
         
            +
            - spec/fixtures/errors/not_scheduled.json
         
     | 
| 
      
 94 
     | 
    
         
            +
            - spec/fixtures/errors/unauthorized.json
         
     | 
| 
      
 95 
     | 
    
         
            +
            - spec/fixtures/lists/list.json
         
     | 
| 
      
 96 
     | 
    
         
            +
            - spec/fixtures/lists/lists.json
         
     | 
| 
      
 97 
     | 
    
         
            +
            - spec/fixtures/marketing_emails/marketing_email.json
         
     | 
| 
      
 98 
     | 
    
         
            +
            - spec/fixtures/marketing_emails/marketing_emails.json
         
     | 
| 
       67 
99 
     | 
    
         
             
            - spec/fixtures/profile.json
         
     | 
| 
      
 100 
     | 
    
         
            +
            - spec/fixtures/recipients.json
         
     | 
| 
      
 101 
     | 
    
         
            +
            - spec/fixtures/schedule.json
         
     | 
| 
      
 102 
     | 
    
         
            +
            - spec/fixtures/sender_addresses/sender_address.json
         
     | 
| 
      
 103 
     | 
    
         
            +
            - spec/fixtures/sender_addresses/sender_addresses.json
         
     | 
| 
       68 
104 
     | 
    
         
             
            - spec/fixtures/stats.json
         
     | 
| 
       69 
105 
     | 
    
         
             
            - spec/fixtures/success.json
         
     | 
| 
       70 
     | 
    
         
            -
            - spec/fixtures/unauthorized.json
         
     | 
| 
       71 
106 
     | 
    
         
             
            - spec/sendgrid/api/client_spec.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - spec/sendgrid/api/entities/category_spec.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - spec/sendgrid/api/entities/email_spec.rb
         
     | 
| 
       72 
109 
     | 
    
         
             
            - spec/sendgrid/api/entities/entity_spec.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - spec/sendgrid/api/entities/list_spec.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - spec/sendgrid/api/entities/marketing_email_spec.rb
         
     | 
| 
       73 
112 
     | 
    
         
             
            - spec/sendgrid/api/entities/profile_spec.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - spec/sendgrid/api/entities/response_insert_spec.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - spec/sendgrid/api/entities/response_remove_spec.rb
         
     | 
| 
       74 
115 
     | 
    
         
             
            - spec/sendgrid/api/entities/response_spec.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - spec/sendgrid/api/entities/schedule_spec.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - spec/sendgrid/api/entities/sender_address_spec.rb
         
     | 
| 
       75 
118 
     | 
    
         
             
            - spec/sendgrid/api/entities/stats_spec.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/categories_spec.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/emails_spec.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/lists_spec.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/marketing_emails_spec.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/recipients_spec.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/schedule_spec.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/sender_addresses_spec.rb
         
     | 
| 
       76 
126 
     | 
    
         
             
            - spec/sendgrid/api/rest/errors/error_spec.rb
         
     | 
| 
       77 
127 
     | 
    
         
             
            - spec/sendgrid/api/rest/resource_spec.rb
         
     | 
| 
       78 
128 
     | 
    
         
             
            - spec/sendgrid/api/rest/response/parse_error_spec.rb
         
     | 
| 
       79 
129 
     | 
    
         
             
            - spec/sendgrid/api/rest/response/parse_json_spec.rb
         
     | 
| 
       80 
130 
     | 
    
         
             
            - spec/sendgrid/api/service_spec.rb
         
     | 
| 
       81 
131 
     | 
    
         
             
            - spec/sendgrid/api/version_spec.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - spec/sendgrid/api/web/mail_spec.rb
         
     | 
| 
       82 
133 
     | 
    
         
             
            - spec/sendgrid/api/web/profile_spec.rb
         
     | 
| 
       83 
134 
     | 
    
         
             
            - spec/sendgrid/api/web/stats_spec.rb
         
     | 
| 
       84 
135 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       85 
136 
     | 
    
         
             
            - spec/support/helpers.rb
         
     | 
| 
       86 
137 
     | 
    
         
             
            - spec/support/mock.rb
         
     | 
| 
      
 138 
     | 
    
         
            +
            - spec/support/online.rb
         
     | 
| 
       87 
139 
     | 
    
         
             
            - spec/support/shared_examples.rb
         
     | 
| 
       88 
140 
     | 
    
         
             
            homepage: ''
         
     | 
| 
       89 
141 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -111,25 +163,59 @@ signing_key: 
     | 
|
| 
       111 
163 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       112 
164 
     | 
    
         
             
            summary: A Ruby interface to the SendGrid API
         
     | 
| 
       113 
165 
     | 
    
         
             
            test_files:
         
     | 
| 
       114 
     | 
    
         
            -
            - spec/fixtures/ 
     | 
| 
      
 166 
     | 
    
         
            +
            - spec/fixtures/categories.json
         
     | 
| 
      
 167 
     | 
    
         
            +
            - spec/fixtures/emails/email.json
         
     | 
| 
      
 168 
     | 
    
         
            +
            - spec/fixtures/emails/emails.json
         
     | 
| 
      
 169 
     | 
    
         
            +
            - spec/fixtures/errors/already_exists.json
         
     | 
| 
      
 170 
     | 
    
         
            +
            - spec/fixtures/errors/bad_request.json
         
     | 
| 
      
 171 
     | 
    
         
            +
            - spec/fixtures/errors/database_error.json
         
     | 
| 
      
 172 
     | 
    
         
            +
            - spec/fixtures/errors/does_not_exist.json
         
     | 
| 
      
 173 
     | 
    
         
            +
            - spec/fixtures/errors/forbidden.json
         
     | 
| 
      
 174 
     | 
    
         
            +
            - spec/fixtures/errors/invalid_fields.json
         
     | 
| 
      
 175 
     | 
    
         
            +
            - spec/fixtures/errors/not_scheduled.json
         
     | 
| 
      
 176 
     | 
    
         
            +
            - spec/fixtures/errors/unauthorized.json
         
     | 
| 
      
 177 
     | 
    
         
            +
            - spec/fixtures/lists/list.json
         
     | 
| 
      
 178 
     | 
    
         
            +
            - spec/fixtures/lists/lists.json
         
     | 
| 
      
 179 
     | 
    
         
            +
            - spec/fixtures/marketing_emails/marketing_email.json
         
     | 
| 
      
 180 
     | 
    
         
            +
            - spec/fixtures/marketing_emails/marketing_emails.json
         
     | 
| 
       115 
181 
     | 
    
         
             
            - spec/fixtures/profile.json
         
     | 
| 
      
 182 
     | 
    
         
            +
            - spec/fixtures/recipients.json
         
     | 
| 
      
 183 
     | 
    
         
            +
            - spec/fixtures/schedule.json
         
     | 
| 
      
 184 
     | 
    
         
            +
            - spec/fixtures/sender_addresses/sender_address.json
         
     | 
| 
      
 185 
     | 
    
         
            +
            - spec/fixtures/sender_addresses/sender_addresses.json
         
     | 
| 
       116 
186 
     | 
    
         
             
            - spec/fixtures/stats.json
         
     | 
| 
       117 
187 
     | 
    
         
             
            - spec/fixtures/success.json
         
     | 
| 
       118 
     | 
    
         
            -
            - spec/fixtures/unauthorized.json
         
     | 
| 
       119 
188 
     | 
    
         
             
            - spec/sendgrid/api/client_spec.rb
         
     | 
| 
      
 189 
     | 
    
         
            +
            - spec/sendgrid/api/entities/category_spec.rb
         
     | 
| 
      
 190 
     | 
    
         
            +
            - spec/sendgrid/api/entities/email_spec.rb
         
     | 
| 
       120 
191 
     | 
    
         
             
            - spec/sendgrid/api/entities/entity_spec.rb
         
     | 
| 
      
 192 
     | 
    
         
            +
            - spec/sendgrid/api/entities/list_spec.rb
         
     | 
| 
      
 193 
     | 
    
         
            +
            - spec/sendgrid/api/entities/marketing_email_spec.rb
         
     | 
| 
       121 
194 
     | 
    
         
             
            - spec/sendgrid/api/entities/profile_spec.rb
         
     | 
| 
      
 195 
     | 
    
         
            +
            - spec/sendgrid/api/entities/response_insert_spec.rb
         
     | 
| 
      
 196 
     | 
    
         
            +
            - spec/sendgrid/api/entities/response_remove_spec.rb
         
     | 
| 
       122 
197 
     | 
    
         
             
            - spec/sendgrid/api/entities/response_spec.rb
         
     | 
| 
      
 198 
     | 
    
         
            +
            - spec/sendgrid/api/entities/schedule_spec.rb
         
     | 
| 
      
 199 
     | 
    
         
            +
            - spec/sendgrid/api/entities/sender_address_spec.rb
         
     | 
| 
       123 
200 
     | 
    
         
             
            - spec/sendgrid/api/entities/stats_spec.rb
         
     | 
| 
      
 201 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/categories_spec.rb
         
     | 
| 
      
 202 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/emails_spec.rb
         
     | 
| 
      
 203 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/lists_spec.rb
         
     | 
| 
      
 204 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/marketing_emails_spec.rb
         
     | 
| 
      
 205 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/recipients_spec.rb
         
     | 
| 
      
 206 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/schedule_spec.rb
         
     | 
| 
      
 207 
     | 
    
         
            +
            - spec/sendgrid/api/newsletter/sender_addresses_spec.rb
         
     | 
| 
       124 
208 
     | 
    
         
             
            - spec/sendgrid/api/rest/errors/error_spec.rb
         
     | 
| 
       125 
209 
     | 
    
         
             
            - spec/sendgrid/api/rest/resource_spec.rb
         
     | 
| 
       126 
210 
     | 
    
         
             
            - spec/sendgrid/api/rest/response/parse_error_spec.rb
         
     | 
| 
       127 
211 
     | 
    
         
             
            - spec/sendgrid/api/rest/response/parse_json_spec.rb
         
     | 
| 
       128 
212 
     | 
    
         
             
            - spec/sendgrid/api/service_spec.rb
         
     | 
| 
       129 
213 
     | 
    
         
             
            - spec/sendgrid/api/version_spec.rb
         
     | 
| 
      
 214 
     | 
    
         
            +
            - spec/sendgrid/api/web/mail_spec.rb
         
     | 
| 
       130 
215 
     | 
    
         
             
            - spec/sendgrid/api/web/profile_spec.rb
         
     | 
| 
       131 
216 
     | 
    
         
             
            - spec/sendgrid/api/web/stats_spec.rb
         
     | 
| 
       132 
217 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       133 
218 
     | 
    
         
             
            - spec/support/helpers.rb
         
     | 
| 
       134 
219 
     | 
    
         
             
            - spec/support/mock.rb
         
     | 
| 
      
 220 
     | 
    
         
            +
            - spec/support/online.rb
         
     | 
| 
       135 
221 
     | 
    
         
             
            - spec/support/shared_examples.rb
         
     |