Sha256: b164371c9ec74e60e05954ad2f1347a8103ba45fca3c2bca4273b191c40e4744

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

# IRKit

[IRKit](http://getirkit.com) Client for Ruby


## Requirements

- Ruby2.0+
- Mac OSX or Linux


## Installation

for Mac

    % gem install irkit

for Debian/Ubuntu Linux

    % sudo apt-get install libavahi-compat-libdnssd-dev
    % gem install irkit


## Usage

see [samples](https://github.com/shokai/ruby-irkit/tree/master/samples)

### Read/Write IR-Data

IRKit has a HTTP-API that can be used from within the same LAN.

```ruby
require 'irkit'

# find IRKit with Bonjour
irkit = IRKit::Device.find.first

# or, specify with IP-Address
# irkit = IRKit::Device.new(address: '192.168.0.123')

unless irkit
  STDERR.puts 'device not found'
  exit 1
end

ir_data = irkit.get_messages
unless ir_data
  STDERR.puts 'IR data not found'
  exit 1
end

p ir_data

puts 'rewrite IR data'
irkit.post_messages ir_data
```


### Internet-API

To access IRKit from outside of the LAN, use Internet-API.
It uses api.getirkit.com as a proxy.


Get `clientkey` and `deviceid`

```ruby
irkit = IRKit::Device.find.first

unless irkit
  STDERR.puts 'device not found'
  exit 1
end

token = irkit.get_token
puts "token: #{token}"
res = irkit.get_key_and_deviceid(token)

puts "clientkey:#{res.clientkey}"
puts "deviceid:#{res.deviceid}"
```


Read/Write with Internet-API

```ruby
irkit = IRKit::InternetAPI.new(clientkey: "your-clientkey", deviceid: "your-deviceid")

unless irkit
  STDERR.puts 'device not found'
  exit 1
end

p irkit

unless ir_data = irkit.get_messages
  STDERR.puts 'IR data not found'
  exit 1
end

p ir_data.message

puts 'rewrite IR data'
irkit.post_messages ir_data.message
```


## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
irkit-0.0.1 README.md