render-component 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +13 -2
- data/Gemfile.lock +57 -0
- data/lib/render/component/client.rb +9 -9
- data/lib/render/component/version.rb +1 -1
- data/render-component.gemspec +4 -0
- metadata +60 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01b3e1f47a2b989201db8741c9c14cca41e20c07
|
4
|
+
data.tar.gz: 29656a9120557b57c85cfa94f099ac8d6c4e22c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84fe3e3eb43efb4af3543d52f68403f603c89a093afaa68e0752190dae10ecf5bd653fb04e6368ca9fe9b66c1037c9447ee2f85306853a307df2033681808c3f
|
7
|
+
data.tar.gz: db900dd1f5cccc21d3985d7f1507319d584b4bc71d5640370aba599119aed1622173e0478f1304864459f2f81db503edca3c75311072c0cb6e347bebe6f91880
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
language: ruby
|
2
|
+
cache:
|
3
|
+
directories:
|
4
|
+
- vendor/bundle
|
5
|
+
sudo: false
|
2
6
|
rvm:
|
3
|
-
- 2.2.3
|
4
|
-
|
7
|
+
- '2.2.3'
|
8
|
+
- '2.2.4'
|
9
|
+
- '2.3.0'
|
10
|
+
- 'ruby-head'
|
11
|
+
|
12
|
+
|
13
|
+
install: bundle install --jobs=3 --retry=3
|
14
|
+
|
15
|
+
script: bundle exec rake spec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
render-component (0.3.0)
|
5
|
+
curb (~> 0.9.3)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.4.0)
|
12
|
+
coderay (1.1.1)
|
13
|
+
crack (0.4.3)
|
14
|
+
safe_yaml (~> 1.0.0)
|
15
|
+
curb (0.9.3)
|
16
|
+
diff-lcs (1.2.5)
|
17
|
+
hashdiff (0.3.0)
|
18
|
+
json (2.0.1)
|
19
|
+
method_source (0.8.2)
|
20
|
+
pry (0.10.3)
|
21
|
+
coderay (~> 1.1.0)
|
22
|
+
method_source (~> 0.8.1)
|
23
|
+
slop (~> 3.4)
|
24
|
+
rake (10.5.0)
|
25
|
+
rspec (3.5.0)
|
26
|
+
rspec-core (~> 3.5.0)
|
27
|
+
rspec-expectations (~> 3.5.0)
|
28
|
+
rspec-mocks (~> 3.5.0)
|
29
|
+
rspec-core (3.5.1)
|
30
|
+
rspec-support (~> 3.5.0)
|
31
|
+
rspec-expectations (3.5.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.5.0)
|
34
|
+
rspec-mocks (3.5.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.5.0)
|
37
|
+
rspec-support (3.5.0)
|
38
|
+
safe_yaml (1.0.4)
|
39
|
+
slop (3.6.0)
|
40
|
+
webmock (2.1.0)
|
41
|
+
addressable (>= 2.3.6)
|
42
|
+
crack (>= 0.3.2)
|
43
|
+
hashdiff
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
bundler (~> 1.11)
|
50
|
+
pry
|
51
|
+
rake (~> 10.0)
|
52
|
+
render-component!
|
53
|
+
rspec (~> 3.0)
|
54
|
+
webmock
|
55
|
+
|
56
|
+
BUNDLED WITH
|
57
|
+
1.11.2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
-
require '
|
2
|
+
require 'curb'
|
3
3
|
|
4
4
|
class Render::Component::Client
|
5
5
|
|
@@ -10,19 +10,19 @@ class Render::Component::Client
|
|
10
10
|
private
|
11
11
|
|
12
12
|
def execute_request(component, attributes)
|
13
|
-
uri = URI("#{default_endpoint}/#{component}")
|
14
13
|
|
15
|
-
|
16
|
-
request = Net::HTTP::Post.new(uri.path)
|
17
|
-
request.content_type = 'application/json'
|
18
|
-
request.body = apply_default_attributes(attributes)
|
14
|
+
url = "#{default_endpoint}/#{component}"
|
19
15
|
|
20
|
-
|
16
|
+
response = Curl.get(url) do |curl|
|
17
|
+
curl.headers['X-Content'] = apply_default_attributes(attributes)
|
18
|
+
curl.connect_timeout = 3
|
21
19
|
end
|
22
20
|
|
23
|
-
|
21
|
+
code = response.status.to_i
|
24
22
|
|
25
|
-
|
23
|
+
return response.body_str if code == 200
|
24
|
+
|
25
|
+
raise StandardError.new, "Request Error. URL: #{url}, Response Status Code: #{code}"
|
26
26
|
end
|
27
27
|
|
28
28
|
def apply_default_attributes(attributes)
|
data/render-component.gemspec
CHANGED
@@ -18,7 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_dependency "curb", "~> 0.9.3"
|
22
|
+
spec.add_dependency "json"
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.11"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
spec.add_development_dependency "pry"
|
27
|
+
spec.add_development_dependency "webmock"
|
24
28
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render-component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Gomide
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: curb
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +80,34 @@ dependencies:
|
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
55
111
|
description: ''
|
56
112
|
email:
|
57
113
|
- lucaslg200@gmail.com
|
@@ -64,6 +120,7 @@ files:
|
|
64
120
|
- ".travis.yml"
|
65
121
|
- CODE_OF_CONDUCT.md
|
66
122
|
- Gemfile
|
123
|
+
- Gemfile.lock
|
67
124
|
- README.md
|
68
125
|
- Rakefile
|
69
126
|
- bin/console
|
@@ -94,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
151
|
version: '0'
|
95
152
|
requirements: []
|
96
153
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.4.5
|
154
|
+
rubygems_version: 2.4.5
|
98
155
|
signing_key:
|
99
156
|
specification_version: 4
|
100
157
|
summary: Render Components via API
|