mind_meld 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13ae17c7093f501ad16fa54a99df2dcd562c4ab0
4
+ data.tar.gz: 80bd36c4a5bff8c6ea9b2b989877a81463b2453e
5
+ SHA512:
6
+ metadata.gz: 6b668822f7c8ddf8f8771bfc61776b4f8b10863d595db9ae609d8863693d447d027fa58853f73dc5f86100eca7da3a31f2dca314db1cfeaee42944db51af72f0
7
+ data.tar.gz: 67369ec7b26d29366670b1311905f83f3899672465f5566b41ef5a0a1f8e7cdee3c08651e270c326dd8daf90b7f94af4ddf4684aea7cac0f79c9c5d9f9efae6f
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # mind_meld
2
+ API for Hive Mind
File without changes
File without changes
data/lib/mind_meld.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'json'
2
+ require 'net/http'
3
+ require 'active_support/core_ext/object/to_query'
4
+
5
+ class MindMeld
6
+ def initialize options
7
+ if options[:url]
8
+ uri = URI.parse(options[:url])
9
+ @http = Net::HTTP.new(uri.host, uri.port)
10
+ end
11
+ end
12
+
13
+ def register options
14
+ post 'devices/register', { device: options }
15
+ end
16
+
17
+ private
18
+ def post call, params = {}
19
+ if @http
20
+ begin
21
+ JSON.parse(@http.request_post("/api/#{call}.json", params.to_query).body)
22
+ rescue StandardError => e
23
+ puts e.message
24
+ { error: e.message }
25
+ end
26
+ else
27
+ { error: 'Mind Meld not configured' }
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mind_meld
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joe Haig
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: webmock
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.21'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.21'
55
+ description: API for Hive Mind
56
+ email:
57
+ - joe.haig@bbc.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - README.md
63
+ - lib/mind_meld.rb
64
+ - lib/mind_meld/device.rb
65
+ - lib/mind_meld/hive.rb
66
+ homepage: https://github.org/bbc/mind_meld
67
+ licenses:
68
+ - MIT
69
+ metadata: {}
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 2.4.8
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: API for Hive Mind
90
+ test_files: []