shiny-sdk 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shiny-sdk.rb +12 -9
- data/shiny-sdk.gemspec +2 -3
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9d06204c2a6b099daddda6ff242e731a5369fd8
|
4
|
+
data.tar.gz: 240e2e78af8e9be29714ea1b3d2b305f572758e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5c59472a8dda7b4c886c49e646e328ede39f16b88d048860ae5edeb56f5d490e6854ecb3d09313fb3cfb21176ef0978129d38340d4ea283510063bcf92456e4
|
7
|
+
data.tar.gz: 594ec0e27f42e3f1326dbec123b73d2aec79267febc908993af7f73433a969902402e8454756a48e428a9200466c16d948801ae2f068f9004b3d877dc99a1fef
|
data/lib/shiny-sdk.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'digest/md5'
|
3
3
|
require 'digest/sha1'
|
4
|
-
require '
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
5
6
|
|
6
7
|
class ShinyError < StandardError
|
7
8
|
def initialize(message)
|
@@ -45,22 +46,24 @@ class Shiny
|
|
45
46
|
|
46
47
|
payload["event"] = event.to_json
|
47
48
|
|
48
|
-
|
49
|
-
|
49
|
+
response = Net::HTTP.post_form(URI.parse(url), payload)
|
50
|
+
if response.code != 200
|
50
51
|
return JSON.parse(response.body)
|
51
|
-
|
52
|
-
raise ShinyError.new('Network error:' +
|
52
|
+
else
|
53
|
+
raise ShinyError.new('Network error:' + response.code)
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
def recent
|
57
58
|
# 获取最新项目
|
58
59
|
url = @API_HOST + '/Data/recent'
|
59
|
-
|
60
|
-
|
60
|
+
uri = URI.parse(url)
|
61
|
+
req = Net::HTTP::Get.new(uri)
|
62
|
+
response = Net::HTTP.start(uri.host, uri.port) {|http| http.request req }
|
63
|
+
if response.code != 200
|
61
64
|
return JSON.parse(response.body)
|
62
|
-
|
63
|
-
raise ShinyError.new('Network error:' +
|
65
|
+
else
|
66
|
+
raise ShinyError.new('Network error:' + response.code)
|
64
67
|
end
|
65
68
|
end
|
66
69
|
end
|
data/shiny-sdk.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'shiny-sdk'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.7'
|
4
4
|
s.date = `git log --pretty="%ai" -n 1`.split(" ").first
|
5
5
|
s.summary = "Shiny SDK"
|
6
6
|
s.description = "Shiny Ruby SDK"
|
@@ -8,7 +8,6 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.email = 'i@wug.moe'
|
9
9
|
s.files = `git ls-files -z`.split("\0")
|
10
10
|
s.homepage = 'https://shiny.kotori.moe'
|
11
|
-
s.license
|
12
|
-
s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
|
11
|
+
s.license = 'MIT'
|
13
12
|
s.required_ruby_version = '>= 2.0.0'
|
14
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiny-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koell
|
@@ -9,21 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-10-23 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rest-client
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.6.7
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.6.7
|
12
|
+
dependencies: []
|
27
13
|
description: Shiny Ruby SDK
|
28
14
|
email: i@wug.moe
|
29
15
|
executables: []
|