firmenwissen 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/firmenwissen.rb +1 -0
- data/lib/firmenwissen/http_request.rb +1 -1
- data/lib/firmenwissen/request/base.rb +1 -1
- data/lib/firmenwissen/uri_decorator.rb +9 -0
- data/lib/firmenwissen/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6499228c4827e93416dd1c35718fb4ecd483c67e5ef14f1bd35be6596a6b8acd
|
4
|
+
data.tar.gz: 990c0a68b091c84e7d7046ee8606705c01ab8c67753afac1809621f2a94ba794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f242d64753d4dd251562c8550b5e7b0547579acb8d53f338d42fa6e42ad5d48655d607925e3bcfb855b9c9d15f02e7b59ca09f24eb295b0e1fc63edfe0be3c9a
|
7
|
+
data.tar.gz: 55c3ca5f9fed873de5570fb0e80e70bee788bbbdf5e88372d365380ab67bca61af6d561a7513237aa6300f8043c7b312454024be16c74e3181dd46fdc18e6cf4
|
data/README.md
CHANGED
@@ -51,9 +51,9 @@ Firmenwissen.configure do |config|
|
|
51
51
|
config.user = 'username' # Username for Firmenwissen basic auth (required)
|
52
52
|
config.password = 'password' # Password for Firmenwissen basic auth (required)
|
53
53
|
config.timeout = 5 # Request timeout in seconds
|
54
|
-
|
54
|
+
|
55
55
|
# Configure the endpoint yourself. %s will be replaced by the actual query
|
56
|
-
config.endpoint = 'https://example.com/search?query
|
56
|
+
config.endpoint = 'https://example.com/search?query={query}'
|
57
57
|
end
|
58
58
|
```
|
59
59
|
### Mocking results
|
@@ -62,10 +62,10 @@ In a non production-like environment you will not want to perform real requests
|
|
62
62
|
```ruby
|
63
63
|
Firmenwissen.configure do |config|
|
64
64
|
config.mock_requests = true
|
65
|
-
|
65
|
+
|
66
66
|
# respond with a fixed array
|
67
67
|
config.mock_data = [{ crefo_id: '1111111111', name: 'Test GmbH', ... }, { ... }, ...]
|
68
|
-
|
68
|
+
|
69
69
|
# respond when a query matches an exact keyword
|
70
70
|
# this will return a result mock when you search for 'compeon' or 'test', otherwise an empty result
|
71
71
|
mock_data = {
|
@@ -74,20 +74,20 @@ Firmenwissen.configure do |config|
|
|
74
74
|
}
|
75
75
|
|
76
76
|
config.mock_data = mock_data
|
77
|
-
|
77
|
+
|
78
78
|
# generate your own dynamic response
|
79
79
|
config.mock_data = Proc.new do |query|
|
80
80
|
# your code for mock data generation here
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
# or
|
84
|
-
|
84
|
+
|
85
85
|
class DynamicMockData
|
86
86
|
def call(query)
|
87
87
|
# your code for mock data generation here
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
config.mock_data = DynamicMockData.new
|
92
92
|
end
|
93
93
|
```
|
data/lib/firmenwissen.rb
CHANGED
@@ -7,6 +7,7 @@ require 'firmenwissen/http_request'
|
|
7
7
|
require 'firmenwissen/key_mapper'
|
8
8
|
require 'firmenwissen/request'
|
9
9
|
require 'firmenwissen/suggestion'
|
10
|
+
require 'firmenwissen/uri_decorator'
|
10
11
|
require 'firmenwissen/version'
|
11
12
|
|
12
13
|
require 'firmenwissen/errors/credentials_error'
|
data/lib/firmenwissen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firmenwissen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerrit Seger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/firmenwissen/response/base.rb
|
103
103
|
- lib/firmenwissen/response/mock.rb
|
104
104
|
- lib/firmenwissen/suggestion.rb
|
105
|
+
- lib/firmenwissen/uri_decorator.rb
|
105
106
|
- lib/firmenwissen/version.rb
|
106
107
|
homepage:
|
107
108
|
licenses:
|