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: 3927f7461d624db66ce73adfaa792c0fade9a472
4
- data.tar.gz: bfdfb7c62641f8482361576ad44e330677b18624
3
+ metadata.gz: 0ec5fd4019c49efff7f6ec508dbd49e93c6c7248
4
+ data.tar.gz: 880392184d69b958d6bddc8e130c4f507bcb6766
5
5
  SHA512:
6
- metadata.gz: 4abcb84d3ad752fed4d6b7ed9302936ad0d0c1620df29a319523ec0830d10212bb9a0776318125f9cc5aea7cc10e4e8f874ec49eacbdb1c9b241d7d5decd9de2
7
- data.tar.gz: d48c93f2a7cb85651f14cb8b2833b0ab62b2b0f289d9d35536396d37ffdac2caca3da2a2727625a6f67d15fcdd26b432d7fa4324c683c0392462e010bdfe4bd1
6
+ metadata.gz: 85418a88629d939bd9ff6116e2307353d1071cae9f7a599fdbb7890505c2da0ed089ec19b837d5842fdbe2e1eda77237be36f5cc9b4ee62dcf925469ac4a578e
7
+ data.tar.gz: 3df9f65412f02ce3400754ac0e29ee43c51e6d2d140d8c3bf34f270e8e90a107c0b5d2f4bc4c1b510566952e99ff2d62310efcf9471f062a1151de275b1bd40e
@@ -10,7 +10,7 @@ module SynapsePayRest
10
10
  def create_transaction_path(node_id: , trans_id: nil)
11
11
  path = '/users/' + @client.user_id + '/nodes/' + node_id + '/trans'
12
12
  if trans_id
13
- path += '/%s' %trans_id
13
+ path += '/' + trans_id
14
14
  end
15
15
  return path
16
16
  end
@@ -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(file)
84
+ def attach_file(file_path: )
84
85
  path = create_user_path(user_id: @client.user_id)
85
- file_type = MIME::Types.type_for(file.path).first.content_type
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
- content = file.read
88
- encoded = Base64.encode64(content)
89
+ encoded = Base64.encode64(file_contents)
89
90
  base64_attachment = mime_padding + encoded
90
91
  payload = {
91
92
  'doc' => {
@@ -70,6 +70,7 @@ module SynapsePayRest
70
70
  payload.to_json,
71
71
  @headers)
72
72
  rescue Exception => e
73
+ puts url
73
74
  return JSON.parse(e.response)
74
75
  end
75
76
  return JSON.parse(response)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse_pay_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Hipps