iremocon 0.0.1 → 0.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 +7 -0
- data/CHANGELOG.md +5 -0
- data/README.md +17 -1
- data/lib/iremocon.rb +16 -0
- data/lib/iremocon/version.rb +1 -1
- data/spec/iremocon_spec.rb +44 -16
- metadata +16 -14
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: ba6ef4603ab748e2430b22a5bd2d1b7e392cb1c3
         | 
| 4 | 
            +
              data.tar.gz: 3ac4d1e7256db38b751bbedd3f9747d6b8335159
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: cd68b7e8fa15a83ca61777b0c566c8aa82909db5d311d5ce04dd5f52fbe10ab22868f05494a662d745df394366c3858865ae3739402e4d8ee070d3bb198bcf45
         | 
| 7 | 
            +
              data.tar.gz: 63d3a6e99518e0cdb5b92fa84dac710d8ae7b25b58dfd7c2a7b3a25d3769e78b099d0383e357ac50608630adff7130526acf3c9f90ad3fa727baa8dd5bafe04d
         | 
    
        data/CHANGELOG.md
    ADDED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -8,7 +8,7 @@ $ gem install iremocon | |
| 8 8 | 
             
            ```
         | 
| 9 9 |  | 
| 10 10 | 
             
            ## Usage
         | 
| 11 | 
            -
            iRemocon has following commands.
         | 
| 11 | 
            +
            iRemocon has following commands (for more details, please see [official document](http://i-remocon.com/development/)).
         | 
| 12 12 |  | 
| 13 13 | 
             
            * au 接続確認用
         | 
| 14 14 | 
             
            * is 赤外線発信
         | 
| @@ -20,6 +20,10 @@ iRemocon has following commands. | |
| 20 20 | 
             
            * ts 現在時刻設定
         | 
| 21 21 | 
             
            * tg 現在時刻取得
         | 
| 22 22 | 
             
            * vr ファームバージョン番号の取得
         | 
| 23 | 
            +
            * li 照度センサー値の取得
         | 
| 24 | 
            +
            * hu 湿度センサー値の取得 ※IRM-03WLA用
         | 
| 25 | 
            +
            * te 温度センサー値の取得 ※IRM-03WLA用
         | 
| 26 | 
            +
            * se 照度・湿度・温度センサー値の取得 ※IRM-03WLA用
         | 
| 23 27 |  | 
| 24 28 | 
             
            You can call it as an instance method of Iremocon class.
         | 
| 25 29 |  | 
| @@ -66,4 +70,16 @@ iremocon.tg | |
| 66 70 |  | 
| 67 71 | 
             
            iremocon.vr
         | 
| 68 72 | 
             
            #=> send "*vr"
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            iremocon.li
         | 
| 75 | 
            +
            #=> send "*li"
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            iremocon.hu
         | 
| 78 | 
            +
            #=> send "*hu"
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            iremocon.te
         | 
| 81 | 
            +
            #=> send "*te"
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            iremocon.se
         | 
| 84 | 
            +
            #=> send "*se"
         | 
| 69 85 | 
             
            ```
         | 
    
        data/lib/iremocon.rb
    CHANGED
    
    
    
        data/lib/iremocon/version.rb
    CHANGED
    
    
    
        data/spec/iremocon_spec.rb
    CHANGED
    
    | @@ -10,18 +10,18 @@ describe Iremocon do | |
| 10 10 | 
             
              end
         | 
| 11 11 |  | 
| 12 12 | 
             
              before do
         | 
| 13 | 
            -
                client. | 
| 13 | 
            +
                allow(client).to receive(:puts) # To silence a command result
         | 
| 14 14 | 
             
              end
         | 
| 15 15 |  | 
| 16 16 | 
             
              after do
         | 
| 17 17 | 
             
                server.close
         | 
| 18 | 
            +
                client.telnet.close
         | 
| 18 19 | 
             
              end
         | 
| 19 20 |  | 
| 20 21 | 
             
              describe "#new" do
         | 
| 21 22 | 
             
                context "when connection succeeded" do
         | 
| 22 23 | 
             
                  it "should connect to tcp server by Net::Telnet client" do
         | 
| 23 | 
            -
                    client.telnet. | 
| 24 | 
            -
                    client.telnet.close
         | 
| 24 | 
            +
                    expect(client.telnet).to be_kind_of(Net::Telnet)
         | 
| 25 25 | 
             
                  end
         | 
| 26 26 | 
             
                end
         | 
| 27 27 |  | 
| @@ -36,86 +36,114 @@ describe Iremocon do | |
| 36 36 |  | 
| 37 37 | 
             
              describe "#au" do
         | 
| 38 38 | 
             
                it "should send *au" do
         | 
| 39 | 
            -
                  client.telnet. | 
| 39 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*au")
         | 
| 40 40 | 
             
                  client.au
         | 
| 41 41 | 
             
                end
         | 
| 42 42 | 
             
              end
         | 
| 43 43 |  | 
| 44 44 | 
             
              describe "#is" do
         | 
| 45 45 | 
             
                it "should send *is;<channel>" do
         | 
| 46 | 
            -
                  client.telnet. | 
| 46 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*is;1")
         | 
| 47 47 | 
             
                  client.is(1)
         | 
| 48 48 | 
             
                end
         | 
| 49 49 | 
             
              end
         | 
| 50 50 |  | 
| 51 51 | 
             
              describe "#ic" do
         | 
| 52 52 | 
             
                it "should send *ic;<channel>" do
         | 
| 53 | 
            -
                  client.telnet. | 
| 53 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*ic;1")
         | 
| 54 54 | 
             
                  client.ic(1)
         | 
| 55 55 | 
             
                end
         | 
| 56 56 | 
             
              end
         | 
| 57 57 |  | 
| 58 58 | 
             
              describe "#cc" do
         | 
| 59 59 | 
             
                it "should send *cc" do
         | 
| 60 | 
            -
                  client.telnet. | 
| 60 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*cc")
         | 
| 61 61 | 
             
                  client.cc
         | 
| 62 62 | 
             
                end
         | 
| 63 63 | 
             
              end
         | 
| 64 64 |  | 
| 65 65 | 
             
              describe "#tm" do
         | 
| 66 66 | 
             
                it "should send *tm;<channel>;<time>;<interval>" do
         | 
| 67 | 
            -
                  client.telnet. | 
| 67 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*tm;1;946652400;60")
         | 
| 68 68 | 
             
                  client.tm(1, 946652400, 60)
         | 
| 69 69 | 
             
                end
         | 
| 70 70 |  | 
| 71 71 | 
             
                it "should convert time to epoch time" do
         | 
| 72 | 
            -
                  client.telnet. | 
| 72 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*tm;1;946652400;60")
         | 
| 73 73 | 
             
                  client.tm(1, Time.local(2000), 60)
         | 
| 74 74 | 
             
                end
         | 
| 75 75 |  | 
| 76 76 | 
             
                it "should complement interval with 0 as default" do
         | 
| 77 | 
            -
                  client.telnet. | 
| 77 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*tm;1;946652400;0")
         | 
| 78 78 | 
             
                  client.tm(1, Time.local(2000))
         | 
| 79 79 | 
             
                end
         | 
| 80 80 | 
             
              end
         | 
| 81 81 |  | 
| 82 82 | 
             
              describe "#tl" do
         | 
| 83 83 | 
             
                it "should send *tl" do
         | 
| 84 | 
            -
                  client.telnet. | 
| 84 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*tl")
         | 
| 85 85 | 
             
                  client.tl
         | 
| 86 86 | 
             
                end
         | 
| 87 87 | 
             
              end
         | 
| 88 88 |  | 
| 89 89 | 
             
              describe "#td" do
         | 
| 90 90 | 
             
                it "should send *td;<timer_id>" do
         | 
| 91 | 
            -
                  client.telnet. | 
| 91 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*td;1")
         | 
| 92 92 | 
             
                  client.td(1)
         | 
| 93 93 | 
             
                end
         | 
| 94 94 | 
             
              end
         | 
| 95 95 |  | 
| 96 96 | 
             
              describe "#ts" do
         | 
| 97 97 | 
             
                it "should send *ts;<time>" do
         | 
| 98 | 
            -
                  client.telnet. | 
| 98 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*ts;946652400")
         | 
| 99 99 | 
             
                  client.ts(946652400)
         | 
| 100 100 | 
             
                end
         | 
| 101 101 |  | 
| 102 102 | 
             
                it "should convert time to epoch time" do
         | 
| 103 | 
            -
                  client.telnet. | 
| 103 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*ts;946652400")
         | 
| 104 104 | 
             
                  client.ts(Time.local(2000))
         | 
| 105 105 | 
             
                end
         | 
| 106 106 | 
             
              end
         | 
| 107 107 |  | 
| 108 108 | 
             
              describe "#tg" do
         | 
| 109 109 | 
             
                it "should send *tg" do
         | 
| 110 | 
            -
                  client.telnet. | 
| 110 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*tg")
         | 
| 111 111 | 
             
                  client.tg
         | 
| 112 112 | 
             
                end
         | 
| 113 113 | 
             
              end
         | 
| 114 114 |  | 
| 115 115 | 
             
              describe "#vr" do
         | 
| 116 116 | 
             
                it "should send *vr" do
         | 
| 117 | 
            -
                  client.telnet. | 
| 117 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*vr")
         | 
| 118 118 | 
             
                  client.vr
         | 
| 119 119 | 
             
                end
         | 
| 120 120 | 
             
              end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
              describe "#li" do
         | 
| 123 | 
            +
                it "should send *li" do
         | 
| 124 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*li")
         | 
| 125 | 
            +
                  client.li
         | 
| 126 | 
            +
                end
         | 
| 127 | 
            +
              end
         | 
| 128 | 
            +
             | 
| 129 | 
            +
              describe "#hu" do
         | 
| 130 | 
            +
                it "should send *hu" do
         | 
| 131 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*hu")
         | 
| 132 | 
            +
                  client.hu
         | 
| 133 | 
            +
                end
         | 
| 134 | 
            +
              end
         | 
| 135 | 
            +
             | 
| 136 | 
            +
              describe "#te" do
         | 
| 137 | 
            +
                it "should send *te" do
         | 
| 138 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*te")
         | 
| 139 | 
            +
                  client.te
         | 
| 140 | 
            +
                end
         | 
| 141 | 
            +
              end
         | 
| 142 | 
            +
             | 
| 143 | 
            +
              describe "#se" do
         | 
| 144 | 
            +
                it "should send *se" do
         | 
| 145 | 
            +
                  expect(client.telnet).to receive(:cmd).with("*se")
         | 
| 146 | 
            +
                  client.se
         | 
| 147 | 
            +
                end
         | 
| 148 | 
            +
              end
         | 
| 121 149 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,27 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: iremocon
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 0.0.2
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - Ryo NAKAMURA
         | 
| 9 8 | 
             
            autorequire: 
         | 
| 10 9 | 
             
            bindir: bin
         | 
| 11 10 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-12-25 00:00:00.000000000 Z
         | 
| 13 12 | 
             
            dependencies:
         | 
| 14 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 14 | 
             
              name: rspec
         | 
| 16 | 
            -
              requirement:  | 
| 17 | 
            -
                none: false
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 18 16 | 
             
                requirements:
         | 
| 19 | 
            -
                - -  | 
| 17 | 
            +
                - - ">="
         | 
| 20 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 19 | 
             
                    version: '0'
         | 
| 22 20 | 
             
              type: :development
         | 
| 23 21 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements:  | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 25 27 | 
             
            description: Iremocon is a gem for managing iRemocon through telnet
         | 
| 26 28 | 
             
            email:
         | 
| 27 29 | 
             
            - ryo-nakamura@cookpad.com
         | 
| @@ -29,7 +31,8 @@ executables: [] | |
| 29 31 | 
             
            extensions: []
         | 
| 30 32 | 
             
            extra_rdoc_files: []
         | 
| 31 33 | 
             
            files:
         | 
| 32 | 
            -
            - .gitignore
         | 
| 34 | 
            +
            - ".gitignore"
         | 
| 35 | 
            +
            - CHANGELOG.md
         | 
| 33 36 | 
             
            - Gemfile
         | 
| 34 37 | 
             
            - LICENSE
         | 
| 35 38 | 
             
            - README.md
         | 
| @@ -41,27 +44,26 @@ files: | |
| 41 44 | 
             
            - spec/spec_helper.rb
         | 
| 42 45 | 
             
            homepage: https://github.com/r7kamura/iremocon
         | 
| 43 46 | 
             
            licenses: []
         | 
| 47 | 
            +
            metadata: {}
         | 
| 44 48 | 
             
            post_install_message: 
         | 
| 45 49 | 
             
            rdoc_options: []
         | 
| 46 50 | 
             
            require_paths:
         | 
| 47 51 | 
             
            - lib
         | 
| 48 52 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
              none: false
         | 
| 50 53 | 
             
              requirements:
         | 
| 51 | 
            -
              - -  | 
| 54 | 
            +
              - - ">="
         | 
| 52 55 | 
             
                - !ruby/object:Gem::Version
         | 
| 53 56 | 
             
                  version: '0'
         | 
| 54 57 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 55 | 
            -
              none: false
         | 
| 56 58 | 
             
              requirements:
         | 
| 57 | 
            -
              - -  | 
| 59 | 
            +
              - - ">="
         | 
| 58 60 | 
             
                - !ruby/object:Gem::Version
         | 
| 59 61 | 
             
                  version: '0'
         | 
| 60 62 | 
             
            requirements: []
         | 
| 61 63 | 
             
            rubyforge_project: 
         | 
| 62 | 
            -
            rubygems_version:  | 
| 64 | 
            +
            rubygems_version: 2.2.2
         | 
| 63 65 | 
             
            signing_key: 
         | 
| 64 | 
            -
            specification_version:  | 
| 66 | 
            +
            specification_version: 4
         | 
| 65 67 | 
             
            summary: iRemocon manager
         | 
| 66 68 | 
             
            test_files:
         | 
| 67 69 | 
             
            - spec/iremocon_spec.rb
         |