ifttt-client 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +3 -0
- data/lib/ifttt.rb +29 -0
- metadata +46 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 181490a21d3d1e85deff78416176f83b0a354f8a
|
|
4
|
+
data.tar.gz: 005ecc67ba5f41e319e4013233aab9ef3fe066cd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dd3834127afd467b33939465947c43cc11a80448432cc656e6ef38de12c248bbdcbe43952c56fd93035605cb4397bc7ac6e2bdc8077d1e026a2ae54023775ee2
|
|
7
|
+
data.tar.gz: 0bcbd7955e5e3a07a981e769050a4d9f2bd19df1bac3fd1fccc6fb532c3029d9c65a0d9c7bc64854aa57e974c0e9c54ad219e258627fd602b9807415e09e44e6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/lib/ifttt.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'uri'
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module IFTTT
|
|
6
|
+
class Profile
|
|
7
|
+
def initialize(key)
|
|
8
|
+
@key=key
|
|
9
|
+
end
|
|
10
|
+
def get(event)
|
|
11
|
+
return Net::HTTP.get(URI("https://maker.ifttt.com/trigger/#{event}/with/key/#{@key}"))
|
|
12
|
+
end
|
|
13
|
+
def post(event,array=[])
|
|
14
|
+
hash=Hash.new
|
|
15
|
+
if array!=nil
|
|
16
|
+
for i in 0...array.size
|
|
17
|
+
hash["value#{i+1}"]=array[i]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
uri = URI("https://maker.ifttt.com/trigger/#{event}/with/key/#{@key}")
|
|
21
|
+
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
|
22
|
+
req.body = hash.to_json
|
|
23
|
+
puts hash.to_json
|
|
24
|
+
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
|
25
|
+
http.request(req)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ifttt-client
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Alexander Krushin
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-02-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Simple gem for IFTTT integration.
|
|
14
|
+
email: alex@krushin.ru
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- ".gitignore"
|
|
20
|
+
- Gemfile
|
|
21
|
+
- lib/ifttt.rb
|
|
22
|
+
homepage: https://github.com/krushinru/ifttt
|
|
23
|
+
licenses:
|
|
24
|
+
- MIT
|
|
25
|
+
metadata: {}
|
|
26
|
+
post_install_message:
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubyforge_project:
|
|
42
|
+
rubygems_version: 2.5.2.3
|
|
43
|
+
signing_key:
|
|
44
|
+
specification_version: 4
|
|
45
|
+
summary: IFTTT - Simple IFTTT integration
|
|
46
|
+
test_files: []
|