unisender-rails 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/lib/unisender-rails/sender.rb +22 -7
- data/lib/unisender-rails/version.rb +1 -1
- metadata +10 -5
| @@ -16,16 +16,31 @@ module UnisenderRails | |
| 16 16 | 
             
              	end
         | 
| 17 17 |  | 
| 18 18 | 
             
              	def deliver!(mail)
         | 
| 19 | 
            +
                  mail_to = [*(mail.to)]
         | 
| 19 20 | 
             
                  client = UniSender::Client.new(@settings[:api_key])
         | 
| 20 21 | 
             
                  list_id = @settings[:list_id]
         | 
| 21 | 
            -
                  client. | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 22 | 
            +
                  result = client.subscribe :fields => {:email => mail_to.join(',')},
         | 
| 23 | 
            +
                                            :list_ids => list_id,
         | 
| 24 | 
            +
                                            :double_optin => 3 
         | 
| 25 | 
            +
                  log_event(result)
         | 
| 26 | 
            +
                  result = client.activateContacts :contact_type => 'email',
         | 
| 27 | 
            +
                                                   :contacts => mail_to.join(',')
         | 
| 28 | 
            +
                  log_event(result)                                       
         | 
| 29 | 
            +
                  result = client.sendEmail :subject => mail.subject,
         | 
| 30 | 
            +
                                            :body => mail.body,
         | 
| 31 | 
            +
                                            :sender_email => mail.from,
         | 
| 32 | 
            +
                                            :email => mail_to,
         | 
| 33 | 
            +
                                            :sender_name => @settings[:sender_name] || mail.from.split('@').first,
         | 
| 34 | 
            +
                                            :list_id => list_id,
         | 
| 35 | 
            +
                                            :lang => @settings[:lang] || 'ru'
         | 
| 36 | 
            +
                  log_event(result)
         | 
| 28 37 | 
             
              	end
         | 
| 29 38 |  | 
| 39 | 
            +
                private
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                def log_event(message)
         | 
| 42 | 
            +
                  Rails.logger.info "Unisender mailer result: #{message}" if @settings[:debug] == true
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
             | 
| 30 45 | 
             
              end
         | 
| 31 46 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: unisender-rails
         | 
| 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: 2012- | 
| 12 | 
            +
            date: 2012-11-27 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: uni_sender
         | 
| 16 | 
            -
              requirement:  | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,7 +21,12 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements:  | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ! '>='
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: '0'
         | 
| 25 30 | 
             
            description: It is a wrapper for uni_sender gem
         | 
| 26 31 | 
             
            email:
         | 
| 27 32 | 
             
            - sgribovskiy@aforex.ru
         | 
| @@ -60,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 60 65 | 
             
                  version: '0'
         | 
| 61 66 | 
             
            requirements: []
         | 
| 62 67 | 
             
            rubyforge_project: 
         | 
| 63 | 
            -
            rubygems_version: 1.8. | 
| 68 | 
            +
            rubygems_version: 1.8.24
         | 
| 64 69 | 
             
            signing_key: 
         | 
| 65 70 | 
             
            specification_version: 3
         | 
| 66 71 | 
             
            summary: It is a wrapper for uni_sender gem to use it like rails ActionMailer
         |