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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shiny-sdk.rb +12 -9
  3. data/shiny-sdk.gemspec +2 -3
  4. metadata +2 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fdceddee17c6d6484234d8db414eedcff470f8e
4
- data.tar.gz: c36736f1d0d3391f3fdac4f5349e873781744ee2
3
+ metadata.gz: d9d06204c2a6b099daddda6ff242e731a5369fd8
4
+ data.tar.gz: 240e2e78af8e9be29714ea1b3d2b305f572758e3
5
5
  SHA512:
6
- metadata.gz: 664c3a0540e00d33a88fd72fe3218e6a6d6a0f179fca822bab6ce987619eeea2adf8902007de9c81676fc7139e97925d09fa047422a9da5ba000284704574433
7
- data.tar.gz: 94e0998e4b2c652ee79e307f00135af30d4628e2e0d429e8185c374d1fd2fbb3136dca6613c2df9b90454b224f09daa638c7535237ffe51b87bd9412b3d6a590
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 'rest-client'
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
- begin
49
- response = RestClient.post(url, payload)
49
+ response = Net::HTTP.post_form(URI.parse(url), payload)
50
+ if response.code != 200
50
51
  return JSON.parse(response.body)
51
- rescue => e
52
- raise ShinyError.new('Network error:' + e.to_s)
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
- begin
60
- response = RestClient.get(url)
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
- rescue => e
63
- raise ShinyError.new('Network error:' + e.to_s)
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.6'
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 = 'MIT'
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.6
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: []