yaccl 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: b84663b4ef3de5c21d665ed484b90813f31136c5
4
- data.tar.gz: 13b0d7a833d8f22aa08493b9d16c2cc71275d95b
3
+ metadata.gz: b8c940fed9d928a9ecfc7f4ac3bd34cbd82e7362
4
+ data.tar.gz: 6d46b47b74d4f7cf5a9818206dfc4361cb56c902
5
5
  SHA512:
6
- metadata.gz: c40575eefa58eb2918191c576000c74537e3ca258965c6c7b03daedf9e06ab5c514c4d54260318c808c055080d2856877cf74980c77c0016a279bf4591c66f8d
7
- data.tar.gz: ae679d70f95f5bc62e3408b1bcd0b8f6ab4709328752fa9e78f959332acfbdff1a13d0a3349616617b6696ddabeff4c98d4af91da4c2586bb1e4cb5f98afaa75
6
+ metadata.gz: b14a3c2b5814cbc43a4f0f3c3bb48c094843cdd74c0751c3e303cd280d3a50098e3205be700e36812233e17b9986cd16993c03e62d6e83ecff13e9c3d8be50d4
7
+ data.tar.gz: 74b49b4b8b84924b2f95eb174182203731b14b1cf72d31b9578ec54df1ade267ec01a45d450bf01c745080a0d4c9e813a6106acbd59e58f184c74c0a0b75560f
@@ -42,9 +42,15 @@ module YACCL
42
42
 
43
43
 
44
44
  result = response.body
45
- if response.headers['Content-Type'] =~ /application\/json/
46
- result = MultiJson.load(result, symbolize_keys: true)
45
+
46
+ content_type = if response.respond_to?(:content_type)
47
+ response.content_type
48
+ else
49
+ response.headers['Content-Type']
47
50
  end
51
+
52
+ result = MultiJson.load(result, symbolize_keys: true) if content_type =~ /application\/json/
53
+
48
54
  unless (200...300).include?(response.code.to_i)
49
55
  if result.is_a?(Hash) && result.has_key?(:exception)
50
56
  raise CMISRequestError, "#{response.code} -- #{result[:exception]} -- #{result[:message]}"
@@ -128,7 +134,6 @@ module YACCL
128
134
  end
129
135
 
130
136
  def get(params)
131
-
132
137
  if @@get_cache[params.to_s].nil?
133
138
  request = Typhoeus::Request.new(
134
139
  params[:url],
@@ -137,6 +142,7 @@ module YACCL
137
142
  body: params[:body],
138
143
  params: params[:query],
139
144
  headers: params[:headers],
145
+ followlocation: true
140
146
  )
141
147
  request.run
142
148
  @@get_cache[params.to_s] = request.run
@@ -155,12 +161,14 @@ module YACCL
155
161
  method: :post,
156
162
  body: params[:body],
157
163
  params: params[:query],
158
- headers: params[:headers],
164
+ headers: params[:headers]
159
165
  )
160
166
  request.run
161
167
  end
162
168
 
163
169
  def multipart_post(url, options, headers)
170
+ @@get_cache.clear
171
+
164
172
  url = URI.parse(url)
165
173
  req = Net::HTTP::Post::Multipart.new(url.path, options)
166
174
  headers.each {|key, value| req[key] = value }
data/lib/yaccl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YACCL
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaccl
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
  - Kenneth Geerts