faxplus_api 0.0.2 → 0.0.4
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 +4 -4
- data/README.md +5 -4
- data/lib/faxplus_api/base.rb +7 -7
- data/lib/faxplus_api/file.rb +1 -1
- data/lib/faxplus_api/outbox.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d7d5d99a832e5707096a02ae5209ea2984306a74d964345143acf573616fd9a
|
4
|
+
data.tar.gz: a049ba2bd56c73f3bdb6753a75cf73642128a916c750cc5519631e58bc5ee834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4c22a9b6bfd8a1f0d1afa06202c65ebf04739ca43fe860047a29278641ad17c42579c6a850a151e1fcefcea045926586852199e815d432355e9f388d1e7b0f
|
7
|
+
data.tar.gz: 9f7e41ed1231cd4bd97d8a465fe670dd8062c6659695b5842c01fe251f96e2248ec2ed8df581b47f76b730101b47154bb264e533c7a465d7d7126c51a7399d7f
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Faxplus is a Ruby library for interacting with faxplus APIs.
|
|
6
6
|
To start using faxplus, you first need to add it to your Gemfile, with an entry such as this:
|
7
7
|
|
8
8
|
```ruby
|
9
|
-
gem '
|
9
|
+
gem 'faxplus_api'
|
10
10
|
```
|
11
11
|
|
12
12
|
Afterwards, run `bundle install`
|
@@ -43,7 +43,8 @@ client.fax.revoke(user_id: 'userid', fax_id: 'fax_id') # Delete a fax
|
|
43
43
|
## Files.
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
|
46
|
+
# Upload a file
|
47
|
+
client.file.upload(user_id: 'userid', data: {fax_file: File.open('pdf_file_path.pdf'), multipart: true}) => {:path => "/storage/transient-hsfhadhaskha.pdf"}
|
47
48
|
client.file.get(user_id: 'userid', fax_id: 'fax_id') # Download fax file
|
48
49
|
client.file.fax_report(user_id: 'userid', fax_id: 'fax_id') # Get fax confirmation report
|
49
50
|
```
|
@@ -51,8 +52,8 @@ client.file.fax_report(user_id: 'userid', fax_id: 'fax_id') # Get fax confirmati
|
|
51
52
|
|
52
53
|
```ruby
|
53
54
|
client.outbox.list(user_id: 'userid') # List faxes in the outbox
|
54
|
-
#
|
55
|
-
client.outbox.send(user_id: 'userid') # Send a fax
|
55
|
+
# file_path from the client.file.upload output path
|
56
|
+
client.outbox.send(user_id: 'userid', data: {from: "+12345667", to: ["+12345688"], files: [file_path]}) # Send a fax
|
56
57
|
client.outbox.get(user_id: 'userid', outbox_fax_id: 'outbox_fax_id') # List outgoing faxes
|
57
58
|
client.outbox.update(user_id: 'userid', outbox_fax_id: 'outbox_fax_id') # Delete an outgoing fax
|
58
59
|
client.outbox.delete(user_id: 'userid', outbox_fax_id: 'outbox_fax_id') # Modify an outgoing fax
|
data/lib/faxplus_api/base.rb
CHANGED
@@ -9,16 +9,16 @@ module FaxplusApi
|
|
9
9
|
@base_url = client.base_url
|
10
10
|
end
|
11
11
|
|
12
|
-
def make_request(url
|
12
|
+
def make_request(url:, data:, method: 'get', content_type: 'application/json')
|
13
13
|
begin
|
14
14
|
response = if method == 'post'
|
15
|
-
RestClient.post(url, data
|
15
|
+
RestClient.post(url, data, headers(content_type))
|
16
16
|
elsif method == 'put'
|
17
|
-
RestClient.put(url, data
|
17
|
+
RestClient.put(url, data, headers(content_type))
|
18
18
|
elsif method == 'get'
|
19
|
-
RestClient.get(url, headers)
|
19
|
+
RestClient.get(url, headers(content_type))
|
20
20
|
elsif method == 'delete'
|
21
|
-
RestClient.delete(url, headers)
|
21
|
+
RestClient.delete(url, headers(content_type))
|
22
22
|
end
|
23
23
|
rescue RestClient::ExceptionWithResponse => e
|
24
24
|
return { error: e.response.body }
|
@@ -31,9 +31,9 @@ module FaxplusApi
|
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
-
def headers
|
34
|
+
def headers(content_type)
|
35
35
|
{
|
36
|
-
'Content-Type' =>
|
36
|
+
'Content-Type' => content_type,
|
37
37
|
'Accept' => 'application/json',
|
38
38
|
'Authorization' => "Bearer #{@access_token}"
|
39
39
|
}
|
data/lib/faxplus_api/file.rb
CHANGED
@@ -4,7 +4,7 @@ module FaxplusApi
|
|
4
4
|
class File < Base
|
5
5
|
def upload(url: "#{@base_url}/accounts/%{user_id}/files", user_id:, data: {})
|
6
6
|
url = url % {user_id: user_id}
|
7
|
-
make_request(url: url, data: data, method: 'post')
|
7
|
+
make_request(url: url, data: data, method: 'post', content_type: 'multipart/form-data')
|
8
8
|
end
|
9
9
|
|
10
10
|
def get(url: "#{@base_url}/accounts/%{user_id}/files/%{fax_id}", user_id:, fax_id:, data: {})
|
data/lib/faxplus_api/outbox.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faxplus_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dilkhush Soni
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,15 +44,17 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.8.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
description:
|
54
|
+
version: 1.8.6
|
55
|
+
description: |2
|
56
|
+
A simple wrapper around faxplus's API.
|
57
|
+
For detailed documentation, please visit: https://github.com/dilkhush/faxplus-ruby/blob/main/README.md
|
56
58
|
email:
|
57
59
|
- dilkhushsoni2010@gmail.com
|
58
60
|
executables: []
|
@@ -89,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
91
|
- !ruby/object:Gem::Version
|
90
92
|
version: '0'
|
91
93
|
requirements: []
|
92
|
-
rubygems_version: 3.1.
|
94
|
+
rubygems_version: 3.1.6
|
93
95
|
signing_key:
|
94
96
|
specification_version: 4
|
95
97
|
summary: A simple wrapper around faxplus's API
|