rasper_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
- SHA1:
3
- metadata.gz: b16e4020bfba1383418a92a074d986d3b515f92a
4
- data.tar.gz: 3fc0761ad8b71e90795abf8ef534a1bd4c4cff8d
2
+ SHA256:
3
+ metadata.gz: ad1b1e23e2e234873e1493e49377b95ef516f54a7d2cf2a4b069fd0c6c91f615
4
+ data.tar.gz: c266e06cdb400c59345d29fc1086c8fa79c27b3fab5145d865dc4d49bbc6ebae
5
5
  SHA512:
6
- metadata.gz: d798a0473b785f9d1f689d9da66d08064b63dddb31d030a594d18caf700084e0d974154fb60c379e86de14f3a1d0533c9391457d39dafa28c6f1b88fbfcbbc14
7
- data.tar.gz: 2f135344ad690d5c34a40fa1d9da959e571856b3705a9be0e948ef7255ef32f62c23199f3208cb3190467d1f9a2fc0c449f0fac4946598a4db1ba5c4120703e4
6
+ metadata.gz: b720447e9574241aae7a4f8a2463dc5c0188119e2d4c16158c03698aaa39c2922fba63baa42db030d1fca49c47b79226cc724cc91d6f65a93982f980d0fcd850
7
+ data.tar.gz: 52b8b60cba6aa0e83c7209a38151554fbbcf9fc43cfb57889aaba8570de7b095ba060ffa66d1d5d1ab00ad6118d7342a12a7e10e2ed5b70b534d29065fecf3b7
data/README.rst CHANGED
@@ -37,6 +37,12 @@ file content and, optionally, the images to be embedded in the report::
37
37
  { name: 'image2.jpg', content: 'content of image2' }])
38
38
 
39
39
 
40
+ For avoiding errors related to the request size, ``rasper_client`` supports
41
+ adding images separately::
42
+
43
+ client.add(images: [{ name: 'imagem.jpg', content: image_content }])
44
+
45
+
40
46
  With the report uploaded, it's possible generate PDF reports::
41
47
 
42
48
  client.generate(name: 'programmers',
@@ -5,7 +5,8 @@ require 'json'
5
5
  module RasperClient
6
6
  class Client
7
7
  def initialize(options)
8
- @host, @port = options.values_at(:host, :port)
8
+ @host, @port, @timeout = options.values_at(:host, :port, :timeout)
9
+ @request_params = build_request_params
9
10
  end
10
11
 
11
12
  def add(options)
@@ -28,13 +29,19 @@ module RasperClient
28
29
  private
29
30
 
30
31
  def execute_request(action, options)
31
- Net::HTTP.start(@host, @port) do |http|
32
+ Net::HTTP.start(*@request_params) do |http|
32
33
  request = Net::HTTP::Post.new(uri_for(action))
33
34
  request.body = options.to_json
34
35
  http.request(request)
35
36
  end
36
37
  end
37
38
 
39
+ def build_request_params
40
+ params = [@host, @port]
41
+ params << { read_timeout: @timeout } if @timeout
42
+ params
43
+ end
44
+
38
45
  def symbolize_keys(options)
39
46
  %w(name content images report data parameters).each do |s|
40
47
  symbolize_key(options, s)
@@ -68,4 +75,4 @@ module RasperClient
68
75
  "http://#{@host}:#{@port}/#{action}"
69
76
  end
70
77
  end
71
- end
78
+ end
@@ -1,3 +1,3 @@
1
1
  module RasperClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rasper_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
  - Rodrigo Manhães
@@ -14,70 +14,70 @@ dependencies:
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sinatra
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Ruby client to RasperServer.
@@ -87,15 +87,15 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - lib/rasper_client/version.rb
90
+ - Gemfile
91
+ - LICENSE.txt
92
+ - README.rst
93
+ - Rakefile
94
+ - lib/rasper_client.rb
91
95
  - lib/rasper_client/client.rb
92
96
  - lib/rasper_client/errors.rb
93
97
  - lib/rasper_client/fake_server.rb
94
- - lib/rasper_client.rb
95
- - README.rst
96
- - LICENSE.txt
97
- - Rakefile
98
- - Gemfile
98
+ - lib/rasper_client/version.rb
99
99
  homepage: https://github.com/rodrigomanhaes/rasper_client
100
100
  licenses:
101
101
  - MIT
@@ -106,17 +106,17 @@ require_paths:
106
106
  - lib
107
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.0.3
119
+ rubygems_version: 2.7.6
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: JRuby client to RasperServer.