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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65dfeec66a7dc94c44664cfe5015c4f5019ae9cf
4
- data.tar.gz: acef509ae84acf22be2a179dd1b90926b86e9f2f
3
+ metadata.gz: 42dfc3065e9521b0e161616a829a71ae11378f95
4
+ data.tar.gz: cdc11c8200d35335ac94184577f525ce92491d73
5
5
  SHA512:
6
- metadata.gz: bb4984f1b2499ead42b6a9703a211095c65d675d585ad5d3cc8a892d8d44487cf4d95cb61c669be27c7b9963a18d34e537e463e4e3bd914394b88cbf7b499240
7
- data.tar.gz: 25bf9d1087184ac1ebb6d4fcbd17509cd759ba12c646106e4ca6477583fe4a08eab6cd58bfc205da0b4c0a0388d0348012c960811c5bb76af72c7801b673a0e2
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 = client
6
- @data = 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
@@ -1,3 +1,3 @@
1
1
  module Kongkit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-16 00:00:00.000000000 Z
11
+ date: 2016-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty