mebots 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/mebots.rb +36 -0
  3. metadata +45 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7593602b92067c8db7e4c52ef8ed036849063b61
4
+ data.tar.gz: 4f645107d04947c00d543f2e155db1e278b7a742
5
+ SHA512:
6
+ metadata.gz: 1a952cfed396ed774bea93af83943e730f12cfcf9e06af29675da2f21773e27dce1ca74c49ea8dd00a684cd16159632326d745978ee63e04686d016e0f6acd8e
7
+ data.tar.gz: d4de4a0d5286bdbda2a941bfcc8ce37e440d4d035f253a6d8737e97f8bd7fc4a8be8a630a5b4e3f681b23cd91bce660944a4ea81ce2291ea3c828ba6e1605bc6
@@ -0,0 +1,36 @@
1
+ require "net/http"
2
+ require "uri"
3
+ require "json"
4
+
5
+ class Instance
6
+ attr_reader :id
7
+ def initialize(raw)
8
+ @id = raw["id"]
9
+ end
10
+ end
11
+
12
+ class Bot
13
+
14
+ @@HOST = "https://mebotsco.herokuapp.com"
15
+ @@API_ROOT = "/api/"
16
+
17
+ def initialize(slug, token)
18
+ @slug = slug
19
+ @token = token
20
+ end
21
+
22
+ def get(endpoint)
23
+ uri = URI(@@HOST + @@API_ROOT + endpoint + "?token=#{@token}")
24
+
25
+ Net::HTTP.start(uri.host, uri.port,
26
+ :use_ssl => uri.scheme == "https") do |http|
27
+ req = Net::HTTP::Get.new(uri)
28
+
29
+ return JSON.parse(http.request(req).body)
30
+ end
31
+ end
32
+
33
+ def instance(group_id)
34
+ return Instance.new(get("bot/#{@slug}/instance/#{group_id}"))
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mebots
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Erik Boesen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Library for easy interaction with MeBots, a helpful API toolkit for managing
14
+ GroupMe bots.
15
+ email: me@erikboesen.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/mebots.rb
21
+ homepage: https://github.com/ErikBoesen/mebotsrb
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.5.2.3
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Interface with the MeBots API
45
+ test_files: []