nomis-api-client 0.1.2 → 0.1.3

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: 9f01c00cc53dffe021c027cca1743b7520afac04
4
- data.tar.gz: 26f5e98a39244bfa62122d50fb7cfe7639712203
3
+ metadata.gz: 8331486777f74943467a188c9edd6a6159f8b581
4
+ data.tar.gz: fabcabb0dd2386dd6068c12e4fe256dddbdd0d54
5
5
  SHA512:
6
- metadata.gz: 794b3286287839ad68b1b9ecb332e3f366ce77614fdad4c913c6ef9aaa2d662acee92024e4b84fe3c4f6a94ce18bef046450515230443dd12ed6fe5cbdca920a
7
- data.tar.gz: 22d4c0e3db9102a61a01e0095bd8d05558df775b63a0d1835eb64a7acb1ceaa9b524c1218f57418a0e791a42417783d982180d6da1118140ce893d7e3d3b0d75
6
+ metadata.gz: c6c1cebfac9ea504914bdffcd69e23202b992c15094b60649bc2a96f76ca22105445583dfffb4758eaf87676b45888cb4a3fd2b71b275ba1f547b2be4d9cf4ff
7
+ data.tar.gz: a243ab79b348eafaf939a402e29593d97de93572cb8af935f34ca3f99c54568b82b1321be03c0dde999afd2786dd170230f778866e3175643fcffda81ce91185
@@ -74,15 +74,13 @@ module NOMIS
74
74
  end
75
75
 
76
76
  def default_client_key(params = {})
77
- read_client_key_file(
78
- params[:client_key_file] || ENV['NOMIS_API_CLIENT_KEY_FILE']
79
- )
77
+ path = params[:client_key_file] || ENV['NOMIS_API_CLIENT_KEY_FILE']
78
+ path ? read_client_key_file(path) : nil
80
79
  end
81
80
 
82
81
  def default_client_token(params = {})
83
- read_client_key_file(
84
- params[:client_token_file] || ENV['NOMIS_API_CLIENT_TOKEN_FILE']
85
- )
82
+ path = params[:client_token_file] || ENV['NOMIS_API_CLIENT_TOKEN_FILE']
83
+ path ? read_client_key_file(path) : nil
86
84
  end
87
85
 
88
86
  def default_iat_fudge_factor(params={})
@@ -9,12 +9,18 @@ module NOMIS
9
9
 
10
10
  def initialize(raw_response)
11
11
  self.raw_response = raw_response
12
- self.data = JSON.parse(raw_response.body)
12
+ self.data = parse(raw_response)
13
13
  end
14
14
 
15
15
  def body
16
16
  raw_response.body
17
17
  end
18
+
19
+ def parse(response)
20
+ response.content_type == 'application/json' ? \
21
+ JSON.parse(response.body) : response.body
22
+ end
23
+
18
24
  def status
19
25
  raw_response.code
20
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nomis-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Al Davidson