synapse_pay_rest 0.0.5 → 0.0.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec5fd4019c49efff7f6ec508dbd49e93c6c7248
|
4
|
+
data.tar.gz: 880392184d69b958d6bddc8e130c4f507bcb6766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85418a88629d939bd9ff6116e2307353d1071cae9f7a599fdbb7890505c2da0ed089ec19b837d5842fdbe2e1eda77237be36f5cc9b4ee62dcf925469ac4a578e
|
7
|
+
data.tar.gz: 3df9f65412f02ce3400754ac0e29ee43c51e6d2d140d8c3bf34f270e8e90a107c0b5d2f4bc4c1b510566952e99ff2d62310efcf9471f062a1151de275b1bd40e
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mime-types'
|
2
2
|
require 'base64'
|
3
|
+
require 'open-uri'
|
3
4
|
|
4
5
|
module SynapsePayRest
|
5
6
|
class User
|
@@ -80,12 +81,12 @@ module SynapsePayRest
|
|
80
81
|
return response
|
81
82
|
end
|
82
83
|
|
83
|
-
def attach_file(
|
84
|
+
def attach_file(file_path: )
|
84
85
|
path = create_user_path(user_id: @client.user_id)
|
85
|
-
|
86
|
+
file_contents = open(file_path) { |f| f.read }
|
87
|
+
file_type = MIME::Types.type_for(file_path).first.content_type
|
86
88
|
mime_padding = 'data:' + file_type + ';base64,'
|
87
|
-
|
88
|
-
encoded = Base64.encode64(content)
|
89
|
+
encoded = Base64.encode64(file_contents)
|
89
90
|
base64_attachment = mime_padding + encoded
|
90
91
|
payload = {
|
91
92
|
'doc' => {
|