apillary 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +29 -0
- data/README.md +7 -0
- data/apillary.gemspec +15 -0
- data/assets/meme_api.jpeg +0 -0
- data/assets/swapi.jpeg +0 -0
- data/lib/apillary.rb +57 -0
- data/lib/apillary/roadmap.rb +11 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 249d945ce85805c5c61c7de6b425f484b9170ca42a4f22d23600216e5b19d599
|
4
|
+
data.tar.gz: f2f6811a04ec2b9a2042f60cebd642346cea3ac159b9762d34e001ff4808ff7b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 83a5719618cd01122875ad93cf5ed9fb61bdf65ec2d4d31ad994c54878f068882a3a86bbd98cbd6330aa624229f4cb197f49a9af507dee7ff4eaa52f7cb3834f
|
7
|
+
data.tar.gz: 7ef88fbb51e179e945273802a72c99a6cf6df8fe142020baa702c88eb41a1e955b986eabf634e86c37a173350d65fcb0b18869df50608c020b928fa92b7933cb
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kele (0.0.1)
|
5
|
+
httparty (~> 0.13)
|
6
|
+
json (~> 1.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
coderay (1.1.2)
|
12
|
+
httparty (0.15.6)
|
13
|
+
multi_xml (>= 0.5.2)
|
14
|
+
json (1.8.6)
|
15
|
+
method_source (0.9.0)
|
16
|
+
multi_xml (0.6.0)
|
17
|
+
pry (0.11.3)
|
18
|
+
coderay (~> 1.1.0)
|
19
|
+
method_source (~> 0.9.0)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
kele!
|
26
|
+
pry
|
27
|
+
|
28
|
+
BUNDLED WITH
|
29
|
+
1.16.0
|
data/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Kele is a simple API client built to pull student and staff data from [Bloc's](http://www.bloc.io) API. It was written as a Ruby Gem, and uses HTTParty and JSON parsing to consume information in a readable and useful way. Given other APIs and types of requests, it could easily be used to pull data from other sources. In fact, here's some examples:
|
2
|
+
|
3
|
+
**Kele consuming the Star Wars API**
|
4
|
+
![alt-text](assets/swapi.jpeg "That's no moon...")
|
5
|
+
|
6
|
+
**Kele consuming the Meme Generator API**
|
7
|
+
![alt-text](assets/meme_api.jpeg "Hi ho, Kermit the Frog Here!")
|
data/apillary.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'apillary'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2017-12-17'
|
5
|
+
s.summary = 'Apillary API Client'
|
6
|
+
s.description = 'A client for the Bloc API'
|
7
|
+
s.authors = ['Daniel Lakin']
|
8
|
+
s.email = 'DLakin01@gmail.com'
|
9
|
+
s.files = `git ls-files`.split($/)
|
10
|
+
s.require_paths = ['lib']
|
11
|
+
s.homepage = 'http://rubygems.org/gems/apillary'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.add_runtime_dependency 'httparty', '~> 0.13'
|
14
|
+
s.add_runtime_dependency 'json', '~> 1.8'
|
15
|
+
end
|
Binary file
|
data/assets/swapi.jpeg
ADDED
Binary file
|
data/lib/apillary.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
require 'apillary/roadmap'
|
4
|
+
|
5
|
+
class Apillary
|
6
|
+
include HTTParty
|
7
|
+
include JSON
|
8
|
+
include Roadmap
|
9
|
+
|
10
|
+
def initialize(email, password)
|
11
|
+
response = self.class.post("https://www.bloc.io/api/v1/sessions", body: {"email": email, "password": password})
|
12
|
+
@auth_token = response["auth_token"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_me
|
16
|
+
response = self.class.get("https://www.bloc.io/api/v1/users/me", headers: { "authorization" => @auth_token })
|
17
|
+
body = JSON.parse(response.body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_mentor_availability(id)
|
21
|
+
response = self.class.get("https://www.bloc.io/api/v1/mentors/#{id}/student_availability", headers: { "authorization" => @auth_token })
|
22
|
+
body = JSON.parse(response.body)
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_messages(page = nil)
|
26
|
+
if page
|
27
|
+
response = self.class.get("https://www.bloc.io/api/v1/message_threads", body: { page: page }, headers: { "authorization" => @auth_token })
|
28
|
+
body = JSON.parse(response.body)
|
29
|
+
else
|
30
|
+
response = self.class.get("https://www.bloc.io/api/v1/message_threads", headers: { "authorization" => @auth_token })
|
31
|
+
body = JSON.parse(response.body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_message(sender, recipient_id, message, subject)
|
36
|
+
response = self.class.post("https://www.bloc.io/api/v1/messages", headers: { "authorization" => @auth_token }, body: { sender: sender, recipient_id: recipient_id, stripped_text: message, subject: subject})
|
37
|
+
body = JSON.parse(response.body)
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_submission(id, checkpoint_id, branch = nil, commit_link = nil, comment = nil)
|
41
|
+
response = self.class.post("https://www.bloc.io/api/v1/checkpoint_submissions", body: { enrollment_id: id, checkpoint_id: checkpoint_id, assignment_branch: branch, assignment_commit_link: commit_link, comment: comment }, headers: { "authorization" => @auth_token })
|
42
|
+
end
|
43
|
+
|
44
|
+
def update_checkpoint(id, enrollment_id, checkpoint_id, branch = nil, commit_link = nil, comment = nil)
|
45
|
+
response = self.class.put("https://www.bloc.io/api/v1/checkpoint_submissions/:#{id}", body: { enrollment_id: enrollment_id, checkpoint_id: checkpoint_id, assignment_branch: branch, assignment_commit_link: commit_link, comment: comment }, headers: { "authorization" => @auth_token })
|
46
|
+
end
|
47
|
+
|
48
|
+
def star_wars(category, id)
|
49
|
+
response = self.class.get("https://swapi.co/api/#{category}/#{id}")
|
50
|
+
body = JSON.parse(response.body)
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_meme(pageIndex, pageSize, key)
|
54
|
+
response = self.class.get("https://version1.api.memegenerator.net//Generators_Select_ByNew?pageIndex=#{pageIndex}&pageSize=#{pageSize}&apiKey=#{key}")
|
55
|
+
body = JSON.parse(response.body)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Roadmap
|
2
|
+
def get_roadmap(id)
|
3
|
+
response = self.class.get("https://www.bloc.io/api/v1/roadmaps/#{id}", headers: { "authorization" => @auth_token })
|
4
|
+
@roadmap = JSON.parse(response.body)
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_checkpoints(id)
|
8
|
+
response = self.class.get("https://www.bloc.io/api/v1/checkpoints/#{id}", headers: { "authorization" => @auth_token })
|
9
|
+
@checkpoints = JSON.parse(response.body)
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: apillary
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Lakin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
description: A client for the Bloc API
|
42
|
+
email: DLakin01@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
49
|
+
- README.md
|
50
|
+
- apillary.gemspec
|
51
|
+
- assets/meme_api.jpeg
|
52
|
+
- assets/swapi.jpeg
|
53
|
+
- lib/apillary.rb
|
54
|
+
- lib/apillary/roadmap.rb
|
55
|
+
homepage: http://rubygems.org/gems/apillary
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.7.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Apillary API Client
|
79
|
+
test_files: []
|