interfax 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b997340127a787e4a2704e7c1f01015a521d17997d0976b22e543bc6d314df4f
4
- data.tar.gz: c10d94d4089876653d577d94416d46095ef7d07df2ae4803dd51e7ef8a6490d0
3
+ metadata.gz: 99049235b3eab2f35ee17f05f913e1fd00d5b4aef90e83e0acc2b860b411f3de
4
+ data.tar.gz: 950b5e08f1d5027e883c5af8c68128805b05bb515109b438f9fde3d27eb499e1
5
5
  SHA512:
6
- metadata.gz: a6d25d3520eea83661c548048aff289a5e7d9e6c411cda4484fca93ed7dd084f6dd64961338213a03d0b1fda8df731a8b75d5fc3cba7035af5cae349d770d6fd
7
- data.tar.gz: 38d4fa1346105898778b3c3d4a9954b6093d52592dd22ebf28e42d85622802297f3763f5aa44d4cb4fc8d8d47a11106f012b6d3ed72f045af95505bdb70fc305
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).
@@ -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
- DOMAIN = "rest.interfax.net".freeze
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.http = Net::HTTP.new(DOMAIN, Net::HTTP.https_default_port)
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://#{DOMAIN}#{path}")
86
+ uri = URI("https://#{host}#{path}")
83
87
  uri.query = URI.encode_www_form(params)
84
88
  uri
85
89
  end
@@ -43,7 +43,7 @@ class InterFAX::Outbound
43
43
  end
44
44
 
45
45
  def cancel fax_id
46
- fax = @client.post("/outbound/faxes/#{fax_id}/cancel")
46
+ @client.post("/outbound/faxes/#{fax_id}/cancel")
47
47
  true
48
48
  end
49
49
 
@@ -1,3 +1,3 @@
1
1
  module InterFAX
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interfax
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - InterFAX