interfax 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/interfax/client.rb +8 -4
- data/lib/interfax/outbound.rb +1 -1
- data/lib/interfax/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99049235b3eab2f35ee17f05f913e1fd00d5b4aef90e83e0acc2b860b411f3de
|
4
|
+
data.tar.gz: 950b5e08f1d5027e883c5af8c68128805b05bb515109b438f9fde3d27eb499e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e12e38bfdaf0b02a6cf05bbb6e5958b43ce7be9bc30030428c50557e10dc2d4a25a182111d106c20849b66936f889d5bf428c8db3a76bc4a6767a97f8a12de45
|
7
|
+
data.tar.gz: 66e9f7921b694fa7b6ed0ad92071cb5b7854614b951ffd59dbf25d9b8538062963c933ea90ec57a620c7eb4aad8cd33902923a7a2c56fce016eddccbaaecb2a7
|
data/README.md
CHANGED
@@ -526,6 +526,21 @@ bundle install # install dependencies
|
|
526
526
|
rake spec # run all tests
|
527
527
|
```
|
528
528
|
|
529
|
+
### Configuring a custom host
|
530
|
+
|
531
|
+
It might be necessary to specifyc a different host for testing purposes. To
|
532
|
+
achieve this, specify the `host` parameter or `INTERFAX_HOST` environment
|
533
|
+
variable.
|
534
|
+
|
535
|
+
|
536
|
+
```ruby
|
537
|
+
interfax = InterFAX::Client.new(
|
538
|
+
username: '...',
|
539
|
+
password: '...',
|
540
|
+
host: 'test.domain.com'
|
541
|
+
)
|
542
|
+
```
|
543
|
+
|
529
544
|
## License
|
530
545
|
|
531
546
|
This library is released under the [MIT License](LICENSE).
|
data/lib/interfax/client.rb
CHANGED
@@ -9,10 +9,10 @@ module InterFAX
|
|
9
9
|
class BadRequestError < StandardError; end
|
10
10
|
class UnauthorizedError < StandardError; end
|
11
11
|
|
12
|
-
attr_accessor :username, :password, :http
|
12
|
+
attr_accessor :username, :password, :http, :host
|
13
13
|
attr_writer :outbound, :inbound, :account, :documents, :files
|
14
14
|
|
15
|
-
|
15
|
+
HOST = "rest.interfax.net".freeze
|
16
16
|
USER_AGENT = "InterFAX Ruby #{InterFAX::VERSION}".freeze
|
17
17
|
|
18
18
|
def initialize(options = {})
|
@@ -24,7 +24,11 @@ module InterFAX
|
|
24
24
|
ENV['INTERFAX_PASSWORD'] || raise(KeyError, "Missing required argument: password")
|
25
25
|
end
|
26
26
|
|
27
|
-
self.
|
27
|
+
self.host = options.fetch(:host) do
|
28
|
+
ENV['INTERFAX_HOST'] || HOST
|
29
|
+
end
|
30
|
+
|
31
|
+
self.http = Net::HTTP.new(host, Net::HTTP.https_default_port)
|
28
32
|
http.set_debug_output $stdout if options[:debug]
|
29
33
|
http.use_ssl = true
|
30
34
|
end
|
@@ -79,7 +83,7 @@ module InterFAX
|
|
79
83
|
|
80
84
|
def uri_for(path, params = {}, keys = {})
|
81
85
|
params = validate(params, keys)
|
82
|
-
uri = URI("https://#{
|
86
|
+
uri = URI("https://#{host}#{path}")
|
83
87
|
uri.query = URI.encode_www_form(params)
|
84
88
|
uri
|
85
89
|
end
|
data/lib/interfax/outbound.rb
CHANGED
data/lib/interfax/version.rb
CHANGED