faxplus_api 0.0.1 → 0.0.3

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
2
  SHA256:
3
- metadata.gz: 9cff90ca10e3d920252b321f3aa2fc7efeeece3334b095a52a4c46c5260d5dba
4
- data.tar.gz: 5c60b71ccacb08b06425dbfa5e4860a506a93b80ee7945d193b01ef3a52c643e
3
+ metadata.gz: 522e0a417cb9e97b26a73388d7369cfb9cf0cdf9ab4d69ef0e6f20f75f64a029
4
+ data.tar.gz: 502520063d90636f49deaee39b3f341ea9d4b516f67b8108e8a2f4a3b58d0412
5
5
  SHA512:
6
- metadata.gz: 8cdb47c45c58ab5c4a5a628bc5bbf8033c155b66f044852ee02a5d7c8826143d603aaef4a37dd54a1be027141c868f06a4073f064a88eac0008b484c698771c2
7
- data.tar.gz: 02fcc04c4e6d676080b464d2bbaa6d1e7826f02111be7aed005a8cd33778eca08e2e463e7509a8a85f40dd9759763fbb71a70c8c16d793d7b80c0fafa263c831
6
+ metadata.gz: 0c60c55d502184d9e37acb42c7021ab08f33cfa82d46437645e905c7f814c78b8b5961ef0541b3f42c9ea98b1467ca86e16a4bd17d7a279185f2f7e669653199
7
+ data.tar.gz: af05b0b220a6118cbff131c7268bfb1754b1e3545b8ad0892f0d198e5e1681344286696c01f80e3597794dd1e2f9c0100334c682833309fb11c6a15e30f469ca
@@ -9,16 +9,16 @@ module FaxplusApi
9
9
  @base_url = client.base_url
10
10
  end
11
11
 
12
- def make_request(url: , data: , method: 'get')
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.to_json, headers)
15
+ RestClient.post(url, data, headers(content_type))
16
16
  elsif method == 'put'
17
- RestClient.put(url, data.to_json, headers)
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' => 'application/json',
36
+ 'Content-Type' => content_type,
37
37
  'Accept' => 'application/json',
38
38
  'Authorization' => "Bearer #{@access_token}"
39
39
  }
@@ -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: {})
@@ -8,7 +8,7 @@ module FaxplusApi
8
8
  end
9
9
 
10
10
  def send(url: "#{@base_url}/accounts/%{user_id}/outbox", user_id:, data: {})
11
- url = url % {user_id: user_id, fax_id: fax_id}
11
+ url = url % {user_id: user_id}
12
12
  make_request(url: url, data: data, method: 'post')
13
13
  end
14
14
 
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.1
4
+ version: 0.0.3
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-20 00:00:00.000000000 Z
11
+ date: 2024-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.0
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: 2.0.0
54
+ version: 1.8.6
55
55
  description:
56
56
  email:
57
57
  - dilkhushsoni2010@gmail.com
@@ -89,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
- rubygems_version: 3.1.2
92
+ rubygems_version: 3.1.6
93
93
  signing_key:
94
94
  specification_version: 4
95
- summary: A simple wrapper around ifaxapp's API
95
+ summary: A simple wrapper around faxplus's API
96
96
  test_files: []