kongkit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kongkit/client/request.rb +1 -1
- data/lib/kongkit/client/resource.rb +12 -4
- data/lib/kongkit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42dfc3065e9521b0e161616a829a71ae11378f95
|
4
|
+
data.tar.gz: cdc11c8200d35335ac94184577f525ce92491d73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8698006c47bb40e92bdf0ab54553881071c008571ff578afea3bd0989593e6b6941a516ba2e1bbe8f48748748396c064f1f9a59e6f77f4342665a6642f259ff9
|
7
|
+
data.tar.gz: 833f237ceeb37b5e23601e01b90bd343b559855cc2df3f2c07ec072e6bfb34b15692b83cd9b2455056397f011ee498340941b6a13843a3f2ba4d642d7f23cf39
|
@@ -44,7 +44,7 @@ module Kongkit
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def parse(response)
|
47
|
-
Kongkit::Client::Resource.new(self, JSON.parse(response.body, symbolize_names: true))
|
47
|
+
Kongkit::Client::Resource.new(self, JSON.parse(response.body, symbolize_names: true), response.code)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Kongkit
|
2
2
|
class Client
|
3
3
|
class Resource
|
4
|
-
def initialize(client, data)
|
5
|
-
@client
|
6
|
-
@data
|
4
|
+
def initialize(client, data, status_code)
|
5
|
+
@client = client
|
6
|
+
@data = data
|
7
|
+
@status_code = status_code
|
7
8
|
end
|
8
9
|
|
9
10
|
# Allow fields to be retrieved via Hash notation
|
@@ -31,9 +32,16 @@ module Kongkit
|
|
31
32
|
data.inspect
|
32
33
|
end
|
33
34
|
|
35
|
+
# Returns true if there is any error
|
36
|
+
#
|
37
|
+
# @return [Boolean] `true` if the response was an error
|
38
|
+
def error?
|
39
|
+
status_code >= 400
|
40
|
+
end
|
41
|
+
|
34
42
|
private
|
35
43
|
|
36
|
-
attr_reader :client, :data
|
44
|
+
attr_reader :client, :data, :status_code
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
data/lib/kongkit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kongkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Mettler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|