getty_up 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/getty_up/api/util.rb +9 -5
- data/lib/getty_up/version.rb +1 -1
- metadata +2 -2
data/lib/getty_up/api/util.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
module GettyUp
|
2
2
|
module API
|
3
3
|
module Util
|
4
|
-
def post_json(request, endpoint)
|
5
|
-
|
6
|
-
|
4
|
+
def post_json(request, endpoint, debug = false)
|
5
|
+
if debug
|
6
|
+
puts '--- Request to Getty --'
|
7
|
+
puts request
|
8
|
+
end
|
7
9
|
|
8
10
|
#You may wish to replace this code with your preferred library for posting and receiving JSON data.
|
9
11
|
uri = URI.parse(endpoint)
|
@@ -11,8 +13,10 @@ module GettyUp
|
|
11
13
|
http.use_ssl = true
|
12
14
|
|
13
15
|
response = http.post(uri.path, request.to_json, {'Content-Type' =>'application/json'}).body
|
14
|
-
|
15
|
-
|
16
|
+
if debug
|
17
|
+
puts '--- Response from Getty --'
|
18
|
+
puts response
|
19
|
+
end
|
16
20
|
JSON.parse(response)
|
17
21
|
end
|
18
22
|
|
data/lib/getty_up/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getty_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|