noip 0.1 → 0.2
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.
- checksums.yaml +4 -4
 - data/.gitignore +1 -0
 - data/.travis.yml +3 -0
 - data/Gemfile +2 -0
 - data/Gemfile.lock +13 -1
 - data/README.md +11 -4
 - data/Rakefile +0 -1
 - data/bin/noip +1 -1
 - data/lib/noip.rb +6 -2
 - data/lib/noip/cli.rb +24 -0
 - data/lib/noip/credentials.rb +4 -4
 - data/lib/noip/updater.rb +3 -6
 - data/lib/noip/version.rb +1 -1
 - data/noip.gemspec +2 -1
 - data/spec/noip/credentials_spec.rb +12 -63
 - data/spec/noip/updater_spec.rb +9 -10
 - data/spec/noip_spec.rb +12 -1
 - data/spec/spec_helper.rb +4 -0
 - metadata +18 -3
 - data/lib/tasks/noip.rake +0 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3e79babb898c9f0fc1f48a58a2897091f656ffd4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 30e0329f1be0f3e820d52fbfa66c47c1e00ad832
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7c5e7cb3b5670ca2e589213d635c03c069c4611f6cd75dbdefc0b928693bfcb8883d37a219d672788387956875e4b2dcade0bc81e611549c14a7eb6699b62f6a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8b0b61a1e4c5ec8dd6d971273b2ef0ab49eeda4162bb9914ed64126317b767cbc45d7c46598bf8eae9c9cf7ac4a4582ecbeb9865e494dfff8095b1cc9fe56602
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,13 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                noip (0. 
     | 
| 
      
 4 
     | 
    
         
            +
                noip (0.2)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  thor
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            GEM
         
     | 
| 
       7 
8 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
       8 
9 
     | 
    
         
             
              specs:
         
     | 
| 
      
 10 
     | 
    
         
            +
                codeclimate-test-reporter (0.4.8)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  simplecov (>= 0.7.1, < 1.0.0)
         
     | 
| 
       9 
12 
     | 
    
         
             
                coderay (1.1.0)
         
     | 
| 
       10 
13 
     | 
    
         
             
                diff-lcs (1.2.5)
         
     | 
| 
      
 14 
     | 
    
         
            +
                docile (1.1.5)
         
     | 
| 
      
 15 
     | 
    
         
            +
                json (1.8.3)
         
     | 
| 
       11 
16 
     | 
    
         
             
                method_source (0.8.2)
         
     | 
| 
       12 
17 
     | 
    
         
             
                pry (0.10.3)
         
     | 
| 
       13 
18 
     | 
    
         
             
                  coderay (~> 1.1.0)
         
     | 
| 
         @@ -27,13 +32,20 @@ GEM 
     | 
|
| 
       27 
32 
     | 
    
         
             
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       28 
33 
     | 
    
         
             
                  rspec-support (~> 3.3.0)
         
     | 
| 
       29 
34 
     | 
    
         
             
                rspec-support (3.3.0)
         
     | 
| 
      
 35 
     | 
    
         
            +
                simplecov (0.10.0)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  docile (~> 1.1.0)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  json (~> 1.8)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  simplecov-html (~> 0.10.0)
         
     | 
| 
      
 39 
     | 
    
         
            +
                simplecov-html (0.10.0)
         
     | 
| 
       30 
40 
     | 
    
         
             
                slop (3.6.0)
         
     | 
| 
      
 41 
     | 
    
         
            +
                thor (0.19.1)
         
     | 
| 
       31 
42 
     | 
    
         | 
| 
       32 
43 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       33 
44 
     | 
    
         
             
              ruby
         
     | 
| 
       34 
45 
     | 
    
         | 
| 
       35 
46 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
       36 
47 
     | 
    
         
             
              bundler
         
     | 
| 
      
 48 
     | 
    
         
            +
              codeclimate-test-reporter
         
     | 
| 
       37 
49 
     | 
    
         
             
              noip!
         
     | 
| 
       38 
50 
     | 
    
         
             
              pry
         
     | 
| 
       39 
51 
     | 
    
         
             
              rake
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,5 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # noip
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            [](http://badge.fury.io/rb/noip)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://travis-ci.org/asellitt/noip)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://codeclimate.com/github/asellitt/noip)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](https://codeclimate.com/github/asellitt/noip/coverage)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       3 
8 
     | 
    
         
             
            A simple utility for updating [noip](https://www.noip.com/integrate/request)
         
     | 
| 
       4 
9 
     | 
    
         
             
            dynamic DNS records for when your router kinda shit.
         
     | 
| 
       5 
10 
     | 
    
         | 
| 
         @@ -7,18 +12,20 @@ dynamic DNS records for when your router kinda shit. 
     | 
|
| 
       7 
12 
     | 
    
         | 
| 
       8 
13 
     | 
    
         
             
            ### Command Line Interface 
         
     | 
| 
       9 
14 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
            `noip` required three parameters: username, password, and host
         
     | 
| 
       11 
16 
     | 
    
         | 
| 
       12 
17 
     | 
    
         
             
            ```bash
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
            noip update -u username -p h4h-t0tez-l3g1t -h host.to.update
         
     | 
| 
       14 
19 
     | 
    
         
             
            ```
         
     | 
| 
       15 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
            See `noip help update` for more information
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       16 
23 
     | 
    
         
             
            ### Crontab
         
     | 
| 
       17 
24 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
            Here's a sample crontab entry that will schedule the update every 4 hours
         
     | 
| 
       19 
26 
     | 
    
         | 
| 
       20 
27 
     | 
    
         
             
            ```crontab
         
     | 
| 
       21 
     | 
    
         
            -
            0 0,4,8,12,16,20 * * *  
     | 
| 
      
 28 
     | 
    
         
            +
            0 0,4,8,12,16,20 * * * noip update -u username -p h4h-t0tez-l3g1t -h host.to.update
         
     | 
| 
       22 
29 
     | 
    
         
             
            ```
         
     | 
| 
       23 
30 
     | 
    
         | 
| 
       24 
31 
     | 
    
         
             
            ## Contributing
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/bin/noip
    CHANGED
    
    
    
        data/lib/noip.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'noip/agent'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'noip/cli'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'noip/credentials'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'noip/remote_ip'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'noip/updater'
         
     | 
| 
         @@ -6,8 +7,11 @@ require 'noip/version' 
     | 
|
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            module Noip
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              def self.update
         
     | 
| 
       10 
     | 
    
         
            -
                Noip:: 
     | 
| 
      
 10 
     | 
    
         
            +
              def self.update(username, password, host)
         
     | 
| 
      
 11 
     | 
    
         
            +
                credentials = Noip::Credentials.new(username, password, host)
         
     | 
| 
      
 12 
     | 
    
         
            +
                updater = Noip::Updater.new(credentials)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                updater.update
         
     | 
| 
       11 
15 
     | 
    
         
             
              end
         
     | 
| 
       12 
16 
     | 
    
         | 
| 
       13 
17 
     | 
    
         
             
            end
         
     | 
    
        data/lib/noip/cli.rb
    ADDED
    
    | 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'thor'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Noip
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Update < Thor
         
     | 
| 
      
 5 
     | 
    
         
            +
                option :username, :aliases => '-u', :type => :string, :required => true
         
     | 
| 
      
 6 
     | 
    
         
            +
                option :password, :aliases => '-p', :type => :string, :required => true
         
     | 
| 
      
 7 
     | 
    
         
            +
                option :host,     :aliases => '-h', :type => :string, :required => true
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                desc "update", "Update the Dynamic DNS record at noip"
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                long_desc <<-DESC
         
     | 
| 
      
 12 
     | 
    
         
            +
                `update` Update the Dynamic DNS record at noip.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                A simple utility for updating noip (https://www.noip.com/integrate/request)
         
     | 
| 
      
 15 
     | 
    
         
            +
                dynamic DNS records for when your router kinda shit.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                https://github.com/asellitt/noip
         
     | 
| 
      
 18 
     | 
    
         
            +
                DESC
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def update
         
     | 
| 
      
 21 
     | 
    
         
            +
                  Noip.update(options[:username], options[:password], options[:host])
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/noip/credentials.rb
    CHANGED
    
    | 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Noip
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Credentials
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                def initialize(username 
     | 
| 
       5 
     | 
    
         
            -
                  @username = username 
     | 
| 
       6 
     | 
    
         
            -
                  @password = password 
     | 
| 
       7 
     | 
    
         
            -
                  @host     = host 
     | 
| 
      
 4 
     | 
    
         
            +
                def initialize(username, password, host)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  @username = username
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @password = password
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @host     = host
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                attr_reader :username, :password, :host
         
     | 
    
        data/lib/noip/updater.rb
    CHANGED
    
    | 
         @@ -3,7 +3,8 @@ require 'net/http' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Noip
         
     | 
| 
       4 
4 
     | 
    
         
             
              class Updater
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                def initialize
         
     | 
| 
      
 6 
     | 
    
         
            +
                def initialize(credentials)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @credentials = credentials
         
     | 
| 
       7 
8 
     | 
    
         
             
                  initialize_http_request
         
     | 
| 
       8 
9 
     | 
    
         
             
                end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
         @@ -13,7 +14,7 @@ module Noip 
     | 
|
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
              private
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                attr_reader :http, :request, :response
         
     | 
| 
      
 17 
     | 
    
         
            +
                attr_reader :credentials, :http, :request, :response
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
                def initialize_http_request
         
     | 
| 
       19 
20 
     | 
    
         
             
                  @http = Net::HTTP.new('dynupdate.no-ip.com')
         
     | 
| 
         @@ -36,9 +37,5 @@ module Noip 
     | 
|
| 
       36 
37 
     | 
    
         
             
                  @remote_ip ||= Noip::RemoteIp.new
         
     | 
| 
       37 
38 
     | 
    
         
             
                end
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                def credentials
         
     | 
| 
       40 
     | 
    
         
            -
                  @credentials ||= Noip::Credentials.new
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
40 
     | 
    
         
             
              end
         
     | 
| 
       44 
41 
     | 
    
         
             
            end
         
     | 
    
        data/lib/noip/version.rb
    CHANGED
    
    
    
        data/noip.gemspec
    CHANGED
    
    | 
         @@ -6,7 +6,6 @@ require "noip/version" 
     | 
|
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       7 
7 
     | 
    
         
             
              spec.name          = "noip"
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.version       = Noip::VERSION
         
     | 
| 
       9 
     | 
    
         
            -
              spec.executables   = ["noip"]
         
     | 
| 
       10 
9 
     | 
    
         
             
              spec.authors       = ["Anthony Sellitti"]
         
     | 
| 
       11 
10 
     | 
    
         
             
              spec.email         = ["anthony.noip_gem@asellitt.com"]
         
     | 
| 
       12 
11 
     | 
    
         
             
              spec.summary       = "Dynamic DNS updater for No-IP"
         
     | 
| 
         @@ -18,6 +17,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       18 
17 
     | 
    
         
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       19 
18 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       20 
19 
     | 
    
         | 
| 
      
 20 
     | 
    
         
            +
              spec.add_dependency "thor"
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       21 
22 
     | 
    
         
             
              spec.add_development_dependency "bundler"
         
     | 
| 
       22 
23 
     | 
    
         
             
              spec.add_development_dependency "rake"
         
     | 
| 
       23 
24 
     | 
    
         
             
              spec.add_development_dependency "rspec"
         
     | 
| 
         @@ -1,71 +1,20 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe Noip::Credentials do
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
                before do
         
     | 
| 
       6 
     | 
    
         
            -
                  allow(ENV).to receive(:[]).with('NOIP_USERNAME').and_return('env_noip_username')
         
     | 
| 
       7 
     | 
    
         
            -
                  allow(ENV).to receive(:[]).with('NOIP_PASSWORD').and_return('env_noip_password')
         
     | 
| 
       8 
     | 
    
         
            -
                  allow(ENV).to receive(:[]).with('NOIP_HOST').and_return('env_noip_host')
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
              subject(:credentials) { Noip::Credentials.new('username', 'password', 'host') }
         
     | 
| 
       10 
5 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                    let(:username) { 'provided_username'}
         
     | 
| 
       16 
     | 
    
         
            -
                    let(:password) { 'provided_password'}
         
     | 
| 
       17 
     | 
    
         
            -
                    let(:host)     { 'provided_host'}
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                    it { is_expected.to eq 'provided_username' }
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  context 'with no values provided' do
         
     | 
| 
       23 
     | 
    
         
            -
                    let(:username) { nil }
         
     | 
| 
       24 
     | 
    
         
            -
                    let(:password) { nil }
         
     | 
| 
       25 
     | 
    
         
            -
                    let(:host)     { nil }
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    it { is_expected.to eq 'env_noip_username' }
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                describe 'password' do
         
     | 
| 
       32 
     | 
    
         
            -
                  subject(:password) { Noip::Credentials.new(username, password, host).password }
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                  context 'with values provided' do
         
     | 
| 
       35 
     | 
    
         
            -
                    let(:username) { 'provided_username'}
         
     | 
| 
       36 
     | 
    
         
            -
                    let(:password) { 'provided_password'}
         
     | 
| 
       37 
     | 
    
         
            -
                    let(:host)     { 'provided_host'}
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                    it { is_expected.to eq 'provided_password' }
         
     | 
| 
       40 
     | 
    
         
            -
                  end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  context 'with no values provided' do
         
     | 
| 
       43 
     | 
    
         
            -
                    let(:username) { nil }
         
     | 
| 
       44 
     | 
    
         
            -
                    let(:password) { nil }
         
     | 
| 
       45 
     | 
    
         
            -
                    let(:host)     { nil }
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                    it { is_expected.to eq 'env_noip_password' }
         
     | 
| 
       48 
     | 
    
         
            -
                  end
         
     | 
| 
       49 
     | 
    
         
            -
                end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                describe 'host' do
         
     | 
| 
       52 
     | 
    
         
            -
                  subject(:host) { Noip::Credentials.new(username, password, host).host }
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                  context 'with values provided' do
         
     | 
| 
       55 
     | 
    
         
            -
                    let(:username) { 'provided_username'}
         
     | 
| 
       56 
     | 
    
         
            -
                    let(:password) { 'provided_password'}
         
     | 
| 
       57 
     | 
    
         
            -
                    let(:host)     { 'provided_host'}
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                    it { is_expected.to eq 'provided_host' }
         
     | 
| 
       60 
     | 
    
         
            -
                  end
         
     | 
| 
      
 6 
     | 
    
         
            +
              describe '.username' do
         
     | 
| 
      
 7 
     | 
    
         
            +
                subject(:username) { credentials.username }
         
     | 
| 
      
 8 
     | 
    
         
            +
                it { is_expected.to eq 'username' }
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
       61 
10 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
              describe '.password' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                subject(:password) { credentials.password }
         
     | 
| 
      
 13 
     | 
    
         
            +
                it { is_expected.to eq 'password' }
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
       66 
15 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                 
     | 
| 
      
 16 
     | 
    
         
            +
              describe '.host' do
         
     | 
| 
      
 17 
     | 
    
         
            +
                subject(:host) { credentials.host }
         
     | 
| 
      
 18 
     | 
    
         
            +
                it { is_expected.to eq 'host' }
         
     | 
| 
       70 
19 
     | 
    
         
             
              end
         
     | 
| 
       71 
20 
     | 
    
         
             
            end
         
     | 
    
        data/spec/noip/updater_spec.rb
    CHANGED
    
    | 
         @@ -16,15 +16,6 @@ describe Noip::Updater do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                end
         
     | 
| 
       17 
17 
     | 
    
         
             
                before { allow(Noip::RemoteIp).to receive(:new).and_return(remote_ip) }
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                let(:credentials) do
         
     | 
| 
       20 
     | 
    
         
            -
                  instance_double(Noip::Credentials,
         
     | 
| 
       21 
     | 
    
         
            -
                    :username => 'username',
         
     | 
| 
       22 
     | 
    
         
            -
                    :password => 'password',
         
     | 
| 
       23 
     | 
    
         
            -
                    :host => 'host',
         
     | 
| 
       24 
     | 
    
         
            -
                  )
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
                before { allow(Noip::Credentials).to receive(:new).and_return(credentials) }
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
19 
     | 
    
         
             
                let(:http) { instance_double(Net::HTTP) }
         
     | 
| 
       29 
20 
     | 
    
         
             
                before do
         
     | 
| 
       30 
21 
     | 
    
         
             
                  allow(http).to receive(:request)
         
     | 
| 
         @@ -37,7 +28,15 @@ describe Noip::Updater do 
     | 
|
| 
       37 
28 
     | 
    
         
             
                  allow(Net::HTTP::Get).to receive(:new).and_return(request)
         
     | 
| 
       38 
29 
     | 
    
         
             
                end
         
     | 
| 
       39 
30 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                 
     | 
| 
      
 31 
     | 
    
         
            +
                let(:credentials) do
         
     | 
| 
      
 32 
     | 
    
         
            +
                  instance_double(Noip::Credentials,
         
     | 
| 
      
 33 
     | 
    
         
            +
                    :username => 'username',
         
     | 
| 
      
 34 
     | 
    
         
            +
                    :password => 'password',
         
     | 
| 
      
 35 
     | 
    
         
            +
                    :host => 'host',
         
     | 
| 
      
 36 
     | 
    
         
            +
                  )
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                subject(:update) { Noip::Updater.new(credentials).update }
         
     | 
| 
       41 
40 
     | 
    
         
             
                before { update }
         
     | 
| 
       42 
41 
     | 
    
         | 
| 
       43 
42 
     | 
    
         
             
                it 'requests the correct domain' do
         
     | 
    
        data/spec/noip_spec.rb
    CHANGED
    
    | 
         @@ -2,15 +2,26 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe Noip do
         
     | 
| 
       4 
4 
     | 
    
         
             
              describe '.update' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                let(:credentials) { instance_double(Noip::Credentials) }
         
     | 
| 
      
 6 
     | 
    
         
            +
                before { allow(Noip::Credentials).to receive(:new).and_return(credentials) }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       5 
8 
     | 
    
         
             
                let(:updater) { instance_double(Noip::Updater) }
         
     | 
| 
       6 
9 
     | 
    
         
             
                before do
         
     | 
| 
       7 
10 
     | 
    
         
             
                  allow(updater).to receive(:update)
         
     | 
| 
       8 
11 
     | 
    
         
             
                  allow(Noip::Updater).to receive(:new).and_return(updater)
         
     | 
| 
       9 
12 
     | 
    
         
             
                end
         
     | 
| 
       10 
13 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                subject(:update) { Noip.update }
         
     | 
| 
      
 14 
     | 
    
         
            +
                subject(:update) { Noip.update('username', 'password', 'host') }
         
     | 
| 
       12 
15 
     | 
    
         
             
                before { update }
         
     | 
| 
       13 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
                it 'properly constructs the credentials' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  expect(Noip::Credentials).to have_received(:new).with('username', 'password', 'host')
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                it 'provides the updater with the correct credentials' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  expect(Noip::Updater).to have_received(:new).with(credentials)
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       14 
25 
     | 
    
         
             
                it 'pushes a new update to noip' do
         
     | 
| 
       15 
26 
     | 
    
         
             
                  expect(updater).to have_received(:update)
         
     | 
| 
       16 
27 
     | 
    
         
             
                end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: noip
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: '0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: '0.2'
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Anthony Sellitti
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-10-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: thor
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       13 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
28 
     | 
    
         
             
              name: bundler
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -76,6 +90,7 @@ extra_rdoc_files: [] 
     | 
|
| 
       76 
90 
     | 
    
         
             
            files:
         
     | 
| 
       77 
91 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       78 
92 
     | 
    
         
             
            - ".ruby_version"
         
     | 
| 
      
 93 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
       79 
94 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       80 
95 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       81 
96 
     | 
    
         
             
            - LICENSE.md
         
     | 
| 
         @@ -84,11 +99,11 @@ files: 
     | 
|
| 
       84 
99 
     | 
    
         
             
            - bin/noip
         
     | 
| 
       85 
100 
     | 
    
         
             
            - lib/noip.rb
         
     | 
| 
       86 
101 
     | 
    
         
             
            - lib/noip/agent.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/noip/cli.rb
         
     | 
| 
       87 
103 
     | 
    
         
             
            - lib/noip/credentials.rb
         
     | 
| 
       88 
104 
     | 
    
         
             
            - lib/noip/remote_ip.rb
         
     | 
| 
       89 
105 
     | 
    
         
             
            - lib/noip/updater.rb
         
     | 
| 
       90 
106 
     | 
    
         
             
            - lib/noip/version.rb
         
     | 
| 
       91 
     | 
    
         
            -
            - lib/tasks/noip.rake
         
     | 
| 
       92 
107 
     | 
    
         
             
            - noip.gemspec
         
     | 
| 
       93 
108 
     | 
    
         
             
            - spec/noip/agent_spec.rb
         
     | 
| 
       94 
109 
     | 
    
         
             
            - spec/noip/credentials_spec.rb
         
     |