pling-mobilant 0.1.0 → 0.2.0
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/pling/mobilant.rb +3 -6
- data/lib/pling/mobilant/gateway.rb +4 -4
- data/pling-mobilant.gemspec +1 -1
- data/spec/pling/mobilant/gateway_spec.rb +14 -0
- metadata +10 -11
- data/lib/pling/gateway/mobilant.rb +0 -1
    
        data/lib/pling/mobilant.rb
    CHANGED
    
    | @@ -1,9 +1,10 @@ | |
| 1 1 | 
             
            require 'pling'
         | 
| 2 | 
            -
            require 'pling/mobilant/gateway'
         | 
| 3 2 |  | 
| 4 3 | 
             
            module Pling
         | 
| 5 4 | 
             
              module Mobilant
         | 
| 6 | 
            -
             | 
| 5 | 
            +
             | 
| 6 | 
            +
                autoload :Gateway, 'pling/mobilant/gateway'
         | 
| 7 | 
            +
             | 
| 7 8 | 
             
                class InvalidRecipient           < Error; end
         | 
| 8 9 |  | 
| 9 10 | 
             
                class InvalidSender              < Error; end
         | 
| @@ -40,8 +41,4 @@ module Pling | |
| 40 41 | 
             
                end
         | 
| 41 42 |  | 
| 42 43 | 
             
              end
         | 
| 43 | 
            -
              
         | 
| 44 | 
            -
              module Gateway
         | 
| 45 | 
            -
                Mobilant = ::Pling::Mobilant::Gateway
         | 
| 46 | 
            -
              end
         | 
| 47 44 | 
             
            end
         | 
| @@ -1,15 +1,14 @@ | |
| 1 1 | 
             
            require 'faraday'
         | 
| 2 2 |  | 
| 3 | 
            -
            require 'pling/mobilant'
         | 
| 4 | 
            -
             | 
| 5 3 | 
             
            module Pling
         | 
| 6 4 | 
             
              module Mobilant
         | 
| 7 | 
            -
                class Gateway < ::Pling::Gateway | 
| 5 | 
            +
                class Gateway < ::Pling::Gateway
         | 
| 8 6 |  | 
| 9 7 | 
             
                  handles :sms, :mobilant, :mobile
         | 
| 10 8 |  | 
| 11 9 | 
             
                  def initialize(configuration)
         | 
| 12 | 
            -
                     | 
| 10 | 
            +
                    super
         | 
| 11 | 
            +
                    require_configuration([:key])
         | 
| 13 12 | 
             
                  end
         | 
| 14 13 |  | 
| 15 14 | 
             
                  def deliver!(message, device)
         | 
| @@ -20,6 +19,7 @@ module Pling | |
| 20 19 | 
             
                    params[:to]      = sanitize_identifier(device.identifier)
         | 
| 21 20 | 
             
                    params[:route]   = route
         | 
| 22 21 | 
             
                    params[:key]     = configuration[:key]
         | 
| 22 | 
            +
                    params[:charset] = configuration[:charset] if configuration[:charset]
         | 
| 23 23 |  | 
| 24 24 | 
             
                    # optional url parameter
         | 
| 25 25 | 
             
                    params[:from]    = source if source
         | 
    
        data/pling-mobilant.gemspec
    CHANGED
    
    | @@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__) | |
| 3 3 |  | 
| 4 4 | 
             
            Gem::Specification.new do |s|
         | 
| 5 5 | 
             
              s.name        = "pling-mobilant"
         | 
| 6 | 
            -
              s.version     = "0. | 
| 6 | 
            +
              s.version     = "0.2.0"
         | 
| 7 7 | 
             
              s.authors     = ["benedikt", "t6d", "fabrik42"]
         | 
| 8 8 | 
             
              s.email       = ["benedikt@synatic.net", "me@t6d.de", "fabrik42@gmail.com"]
         | 
| 9 9 | 
             
              s.homepage    = "http://flinc.github.com/pling-mobilant"
         | 
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            require 'spec_helper'
         | 
| 2 4 | 
             
            require 'pling/mobilant'
         | 
| 3 5 |  | 
| @@ -59,6 +61,18 @@ module Pling | |
| 59 61 | 
             
                      subject.deliver(message, device)
         | 
| 60 62 | 
             
                    end
         | 
| 61 63 |  | 
| 64 | 
            +
                    it 'should allow configuration of the charset parameter' do
         | 
| 65 | 
            +
                      request.should_receive(:url).with("https://gw.mobilant.net/", {
         | 
| 66 | 
            +
                                                          :message => 'Hello World',
         | 
| 67 | 
            +
                                                          :to => "00491701234567",
         | 
| 68 | 
            +
                                                          :route => :lowcost,
         | 
| 69 | 
            +
                                                          :key => key,
         | 
| 70 | 
            +
                                                          :charset => 'UTF-8'
         | 
| 71 | 
            +
                      })
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                      Pling::Mobilant::Gateway.new(:key => key, :charset => 'UTF-8').deliver(message, device)
         | 
| 74 | 
            +
                    end
         | 
| 75 | 
            +
             | 
| 62 76 | 
             
                    it "should raise an exception when the provider reports an invalid recipient" do
         | 
| 63 77 | 
             
                      response.should_receive(:body).and_return("10")
         | 
| 64 78 | 
             
                      expect { subject.deliver(message, device) }.
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pling-mobilant
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -11,11 +11,11 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2011- | 
| 14 | 
            +
            date: 2011-11-11 00:00:00.000000000Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: rspec
         | 
| 18 | 
            -
              requirement: & | 
| 18 | 
            +
              requirement: &70326436844220 !ruby/object:Gem::Requirement
         | 
| 19 19 | 
             
                none: false
         | 
| 20 20 | 
             
                requirements:
         | 
| 21 21 | 
             
                - - ~>
         | 
| @@ -23,10 +23,10 @@ dependencies: | |
| 23 23 | 
             
                    version: '2.7'
         | 
| 24 24 | 
             
              type: :development
         | 
| 25 25 | 
             
              prerelease: false
         | 
| 26 | 
            -
              version_requirements: * | 
| 26 | 
            +
              version_requirements: *70326436844220
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: yard
         | 
| 29 | 
            -
              requirement: & | 
| 29 | 
            +
              requirement: &70326436842700 !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                none: false
         | 
| 31 31 | 
             
                requirements:
         | 
| 32 32 | 
             
                - - ! '>='
         | 
| @@ -34,10 +34,10 @@ dependencies: | |
| 34 34 | 
             
                    version: '0.7'
         | 
| 35 35 | 
             
              type: :development
         | 
| 36 36 | 
             
              prerelease: false
         | 
| 37 | 
            -
              version_requirements: * | 
| 37 | 
            +
              version_requirements: *70326436842700
         | 
| 38 38 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 39 39 | 
             
              name: rake
         | 
| 40 | 
            -
              requirement: & | 
| 40 | 
            +
              requirement: &70326436841800 !ruby/object:Gem::Requirement
         | 
| 41 41 | 
             
                none: false
         | 
| 42 42 | 
             
                requirements:
         | 
| 43 43 | 
             
                - - ! '>='
         | 
| @@ -45,10 +45,10 @@ dependencies: | |
| 45 45 | 
             
                    version: '0.9'
         | 
| 46 46 | 
             
              type: :development
         | 
| 47 47 | 
             
              prerelease: false
         | 
| 48 | 
            -
              version_requirements: * | 
| 48 | 
            +
              version_requirements: *70326436841800
         | 
| 49 49 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 50 50 | 
             
              name: pling
         | 
| 51 | 
            -
              requirement: & | 
| 51 | 
            +
              requirement: &70326436841000 !ruby/object:Gem::Requirement
         | 
| 52 52 | 
             
                none: false
         | 
| 53 53 | 
             
                requirements:
         | 
| 54 54 | 
             
                - - ! '>='
         | 
| @@ -56,7 +56,7 @@ dependencies: | |
| 56 56 | 
             
                    version: '0'
         | 
| 57 57 | 
             
              type: :runtime
         | 
| 58 58 | 
             
              prerelease: false
         | 
| 59 | 
            -
              version_requirements: * | 
| 59 | 
            +
              version_requirements: *70326436841000
         | 
| 60 60 | 
             
            description: 
         | 
| 61 61 | 
             
            email:
         | 
| 62 62 | 
             
            - benedikt@synatic.net
         | 
| @@ -74,7 +74,6 @@ files: | |
| 74 74 | 
             
            - LICENSE
         | 
| 75 75 | 
             
            - README.md
         | 
| 76 76 | 
             
            - Rakefile
         | 
| 77 | 
            -
            - lib/pling/gateway/mobilant.rb
         | 
| 78 77 | 
             
            - lib/pling/mobilant.rb
         | 
| 79 78 | 
             
            - lib/pling/mobilant/gateway.rb
         | 
| 80 79 | 
             
            - pling-mobilant.gemspec
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            require 'pling/mobilant'
         |