supai 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c59a70d01ff7076446af452ddd69bcd069c22d02f00d1670c5be41f3b0266d5
4
- data.tar.gz: 73dc570cc931bf4586724fcf30e588239117af5291aa776662c66012410cd054
3
+ metadata.gz: 37f3aa8a7bd54c6b4532627e27a6ac8022dd3f8891b84c5c1a826f460d131249
4
+ data.tar.gz: b90054b34cdf5f0a149e1348ed5ed7d28ad6a21d02b3b6dbc59e817ff7eb9ba2
5
5
  SHA512:
6
- metadata.gz: 8496674fe813855155b46b1f96ced76ddc650e3a9c91bd2bd24083ff71be1e5b55ad7b6496d6f39e6c9eb224dc82790729de61528bb4c08c2c25c430b4dab732
7
- data.tar.gz: 329809ba728cce968adf08b51ff76bf0ed4307d8d9e354d7e15ba09334034d99606605d34a51f427702e86c4a7ce2f43b90cbc86b9dc5bbc6bf6c7f8685064a2
6
+ metadata.gz: 61caad8bfa33c8cb279911483b77047c4ddd2c6dcb6519d87d03acfc22d30db7eacb5fbc30abdd55b5c490ccb90d8aa971941670bd5a8d5439d98dc7387191ec
7
+ data.tar.gz: facd22ab23431920082c5ca2cf82d11e26c660d807de6ff2f4e35c312978694955998ff9d6111ec54eea19ccceb8195e1acfce8e1677786448bef9152bf315df
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- supai (0.2.0)
4
+ supai (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/supai/api.rb CHANGED
@@ -43,7 +43,13 @@ module Supai
43
43
  end
44
44
 
45
45
  def initialize(host = DEFAULT_HOST)
46
- @host = host
46
+ @host = sanitize_host(host)
47
+ end
48
+
49
+ def sanitize_host(host)
50
+ host = host.split("://", 2).last
51
+ host = host[0..-2] if host.end_with?("/")
52
+ host
47
53
  end
48
54
 
49
55
  def request(method, endpoint, body: nil, params: {}, headers: {}, token: nil)
@@ -4,7 +4,7 @@ module Supai
4
4
 
5
5
  attr_accessor :token, :secret, :user_id
6
6
 
7
- def self.create(authorization)
7
+ def self.create(authorization, api: API.new)
8
8
  api = API.new
9
9
  response = api.request(:post, ENDPOINT, body: {}, token: authorization)
10
10
  raise response.error unless response.success?
data/lib/supai/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Supai
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Yoder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler