interfax 1.1.0 → 1.2.1

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: 55720a871ff442165ff9c12c3c1c8b51bd4cab07
4
- data.tar.gz: c36611237b5d777b2526e96261cad0519d679a22
2
+ SHA256:
3
+ metadata.gz: 55d673c5fd839809a644439bd8ed4de14c8c1018ebc3adce0935e82efdd98228
4
+ data.tar.gz: a0a064893dc599f083c8cc53957d5eac5b69bbad08e7c3e015acd9d4930a7baf
5
5
  SHA512:
6
- metadata.gz: bf3283be3e11cdacc296af03433775a172ac14cc28fbec679359677e1fb0416ab9ef587400823d8e72ba07731af15abb98bbc5a1954511878352df59734ee3d5
7
- data.tar.gz: f7a4fac0ac9322ad16f579f2f4c8957d89b218187132797273340922b0c67a7ac5450906945a93503f60a4123b227e39c7c48dda53a9fc87c84058ea2a8bb31e
6
+ metadata.gz: b5d1b8f1948d87e0e4e8bae3070e55c224be1eaee1f3525fc04f1de4599a627f06a20c7f680f07b1c6e76dcd7567e6734717e5bf5cb583bd741a85e28b695e6c
7
+ data.tar.gz: ec97b3f5bf76d5c26f933f9047e9d2865560730fb95767a2dad0391eab6d1e9d9d4cd3ce52f8b5062d30f23fc581dca4b6ce046dbdeaff27afb2e2dcabe678ed
data/README.md CHANGED
@@ -11,7 +11,7 @@ Send and receive faxes in Ruby with the [InterFAX](https://www.interfax.net/en/d
11
11
  This gem requires Ruby 2.1+. You can install install it directly or via bundler.
12
12
 
13
13
  ```ruby
14
- gem 'interfax', '~> 1.0.0'
14
+ gem 'interfax'
15
15
  ```
16
16
 
17
17
  ## Getting started
@@ -76,7 +76,7 @@ There are a few ways to send a fax. One way is to directly provide a file path o
76
76
  # with a path
77
77
  interfax.outbound.deliver(faxNumber: "+11111111112", file: 'folder/fax.txt')
78
78
  # with a URL
79
- interfax.outbound.deliver(faxNumber: "+11111111112", file: 'https://s3.aws.com/example/fax.pdf')
79
+ interfax.outbound.deliver(faxNumber: "+11111111112", file: 'https://s3.aws.com/example/fax.html')
80
80
  ```
81
81
 
82
82
  InterFAX supports over 20 file types including HTML, PDF, TXT, Word, and many more. For a full list see the [Supported File Types](https://www.interfax.net/en/help/supported_file_types) documentation.
@@ -103,7 +103,7 @@ interfax.outbound.deliver(faxNumber: "+11111111112", file: file)
103
103
  To send multiple files just pass in an array strings and [`InterFAX::File`](#interfaxfile) objects.
104
104
 
105
105
  ```rb
106
- interfax.outbound.deliver(faxNumber: "+11111111112", files: ['file://fax.pdf', 'https://s3.aws.com/example/fax.pdf'])
106
+ interfax.outbound.deliver(faxNumber: "+11111111112", files: ['file://fax.pdf', 'https://s3.aws.com/example/fax.html'])
107
107
  ```
108
108
 
109
109
  Under the hood every path and string is turned into a [InterFAX::File](#interfaxfile) object. For more information see [the documentation](#interfaxfile) for this class.
@@ -526,10 +526,25 @@ 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).
532
547
 
533
548
  ## Credits
534
549
 
535
- Many thanks go to [Sascha Brink](https://github.com/sbrink) for building the pre 1.0 version of this gem and supporting it for so many years.
550
+ Many thanks go to [Sascha Brink] (https://github.com/sbrink) for building the pre 1.0 version of this gem and supporting it for so many years.
@@ -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
@@ -47,6 +47,6 @@ class InterFAX::Outbound::Delivery
47
47
  def body_for(files)
48
48
  files.map do |file|
49
49
  "--#{BOUNDARY}\r\n#{file.header}\r\n\r\n#{file.body}\r\n"
50
- end.join + "--#{BOUNDARY}\r\n"
50
+ end.join + "--#{BOUNDARY}--\r\n"
51
51
  end
52
52
  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.0'
2
+ VERSION = '1.2.1'
3
3
  end
data/lib/interfax.rb CHANGED
@@ -13,5 +13,5 @@ require 'interfax/inbound/fax'
13
13
  require 'interfax/image'
14
14
  require 'interfax/document'
15
15
  require 'interfax/documents'
16
-
17
16
  require 'mimemagic'
17
+ require 'mimemagic/overlay'
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interfax
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - InterFAX
8
8
  - Cristiano Betta
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-19 00:00:00.000000000 Z
12
+ date: 2022-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mimemagic
@@ -112,7 +112,7 @@ homepage: https://github.com/interfax/interfax-ruby
112
112
  licenses:
113
113
  - MIT
114
114
  metadata: {}
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options: []
117
117
  require_paths:
118
118
  - lib
@@ -127,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubyforge_project:
131
- rubygems_version: 2.5.1
132
- signing_key:
130
+ rubygems_version: 3.3.7
131
+ signing_key:
133
132
  specification_version: 4
134
133
  summary: Send and receive faxes with InterFAX
135
134
  test_files: []