worldtimeengine 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/README.md +1 -1
- data/lib/worldtimeengine/client.rb +6 -2
- data/spec/fixtures/kyrgyzstan-158.181.193.14.xml +20 -0
- data/spec/worldtimeengine_spec.rb +15 -0
- data/worldtimeengine.gemspec +1 -1
- metadata +5 -3
    
        data/README.md
    CHANGED
    
    
| @@ -52,9 +52,13 @@ module WorldTimeEngine | |
| 52 52 |  | 
| 53 53 | 
             
                    mash.time.zone.current.is_dst = to_boolean mash.time.zone.current.isdst
         | 
| 54 54 | 
             
                    mash.time.zone.current.utc_offset = mash.time.zone.current.utcoffset
         | 
| 55 | 
            -
                    mash.time.zone.current.effective_until = Time.parse "#{mash.time.zone.current.effectiveUntil} #{mash.time.zone.current.abbreviation} #{mash.time.zone.current.utcoffset}"
         | 
| 56 55 |  | 
| 57 | 
            -
                     | 
| 56 | 
            +
                    # could be missing for not recognized IPs
         | 
| 57 | 
            +
                    unless mash.time.zone.current.effectiveUntil.nil?
         | 
| 58 | 
            +
                      mash.time.zone.current.effective_until = Time.parse "#{mash.time.zone.current.effectiveUntil} #{mash.time.zone.current.abbreviation} #{mash.time.zone.current.utcoffset}"
         | 
| 59 | 
            +
                    end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                    if mash.time.zone.has_dst
         | 
| 58 62 | 
             
                      mash.time.zone.next.is_dst = to_boolean mash.time.zone.next.isdst
         | 
| 59 63 | 
             
                      mash.time.zone.next.utc_offset = mash.time.zone.next.utcoffset
         | 
| 60 64 | 
             
                      mash.time.zone.next.effective_until = Time.parse "#{mash.time.zone.next.effectiveUntil} #{mash.time.zone.next.abbreviation} #{mash.time.zone.next.utcoffset}"
         | 
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            <timezone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://worldtimeengine.com/timezone.xsd">
         | 
| 2 | 
            +
                <version>1.1</version>
         | 
| 3 | 
            +
                <location>
         | 
| 4 | 
            +
                    <region></region>
         | 
| 5 | 
            +
                    <latitude></latitude>
         | 
| 6 | 
            +
                    <longitude></longitude>
         | 
| 7 | 
            +
                </location>
         | 
| 8 | 
            +
                <time>
         | 
| 9 | 
            +
                    <utc>1970-01-01 00:00:00</utc>
         | 
| 10 | 
            +
                    <local>1970-01-01 00:00:00</local>
         | 
| 11 | 
            +
                    <zone>
         | 
| 12 | 
            +
                        <hasDST>false</hasDST>
         | 
| 13 | 
            +
                        <current>
         | 
| 14 | 
            +
                            <abbreviation></abbreviation>
         | 
| 15 | 
            +
                            <description></description>
         | 
| 16 | 
            +
                            <utcoffset></utcoffset>
         | 
| 17 | 
            +
                        </current>
         | 
| 18 | 
            +
                    </zone>
         | 
| 19 | 
            +
                </time>
         | 
| 20 | 
            +
            </timezone>
         | 
| @@ -39,6 +39,21 @@ describe WorldTimeEngine do | |
| 39 39 | 
             
                end
         | 
| 40 40 | 
             
              end
         | 
| 41 41 |  | 
| 42 | 
            +
              context 'unknown IP address' do
         | 
| 43 | 
            +
                before do
         | 
| 44 | 
            +
                  WorldTimeEngine.configure do |config|
         | 
| 45 | 
            +
                    config.api_key = 'abc'
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  stub_request(:get, "http://worldtimeengine.com/api/ip/abc/158.181.193.14").
         | 
| 49 | 
            +
                    to_return(:status => 200, :body => fixture('kyrgyzstan-158.181.193.14.xml'), :headers => {})
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                it "does not fail" do
         | 
| 53 | 
            +
                  WorldTimeEngine.api('158.181.193.14')
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
              end
         | 
| 56 | 
            +
             | 
| 42 57 | 
             
              context "region with DST" do
         | 
| 43 58 | 
             
                before do
         | 
| 44 59 | 
             
                  WorldTimeEngine.configure do |config|
         | 
    
        data/worldtimeengine.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: worldtimeengine
         | 
| 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,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-08- | 
| 12 | 
            +
            date: 2012-08-29 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: hashie
         | 
| @@ -124,6 +124,7 @@ files: | |
| 124 124 | 
             
            - lib/worldtimeengine.rb
         | 
| 125 125 | 
             
            - spec/fixtures/germany-193.174.32.100.xml
         | 
| 126 126 | 
             
            - spec/fixtures/kazakhstan-212.154.168.243.xml
         | 
| 127 | 
            +
            - spec/fixtures/kyrgyzstan-158.181.193.14.xml
         | 
| 127 128 | 
             
            - spec/fixtures/us.xml
         | 
| 128 129 | 
             
            - spec/fixtures/wrong_key.xml
         | 
| 129 130 | 
             
            - spec/helper.rb
         | 
| @@ -142,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 142 143 | 
             
                  version: '0'
         | 
| 143 144 | 
             
                  segments:
         | 
| 144 145 | 
             
                  - 0
         | 
| 145 | 
            -
                  hash:  | 
| 146 | 
            +
                  hash: 206980578948058900
         | 
| 146 147 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 147 148 | 
             
              none: false
         | 
| 148 149 | 
             
              requirements:
         | 
| @@ -158,6 +159,7 @@ summary: WorldTimeEngine API wrapper | |
| 158 159 | 
             
            test_files:
         | 
| 159 160 | 
             
            - spec/fixtures/germany-193.174.32.100.xml
         | 
| 160 161 | 
             
            - spec/fixtures/kazakhstan-212.154.168.243.xml
         | 
| 162 | 
            +
            - spec/fixtures/kyrgyzstan-158.181.193.14.xml
         | 
| 161 163 | 
             
            - spec/fixtures/us.xml
         | 
| 162 164 | 
             
            - spec/fixtures/wrong_key.xml
         | 
| 163 165 | 
             
            - spec/helper.rb
         |