rs4 0.1.1 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 376ed103e27c3b47fb34551055c590b8212e9945deb78d8def33f2409b33e662
4
- data.tar.gz: ec8890b3dbcf688a036c270ceddd93d231c33369b4ed3cd0049c00f9d0fcfd6a
3
+ metadata.gz: d11e0ed8ace80f96d0ffde3b72915bfcd77c7eff73c47eb8682751e88b385755
4
+ data.tar.gz: cc830ddf9f7684734e687a6f85a17aa21726f1ca01bb45798a7c0ae5951087fc
5
5
  SHA512:
6
- metadata.gz: 5388b4533dd5876f2e85ca12d169cf6bc3ba150549169dc3c0be303e396048c74eb501fc44f41e4b21e68c15e4b9b7b462da9463f1c15ac74a69e3647183260d
7
- data.tar.gz: a6ea6a0c6c1145687869f1bbcce4812f0e4da3ed19781149420aff8f88011bf6068017b6ea5d4af81cb0f6b67fae272097997ecc93eacbeaafe11e9b10b2aa1b
6
+ metadata.gz: b07928a830d6a935334c2ae13384c322beb41056cb4648f5905fbf7c2774de91fc0b338587d50719c6b8acffd101d086ea1dbf0e6e9276f6970ccd2058e8b9bf
7
+ data.tar.gz: 5ae429530d7eb69a6794d0458ee8c30ab28dec8499879bb4b4108977d8d4dc7025267fefd91337eff9ea0fe0885b02a0573ad37dec195129a38bf3705a8bd37a
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  *.gem
13
+ *.swp
@@ -0,0 +1,12 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'openssl'
4
+
5
+ require 'rs4/request.rb'
6
+ require 'rs4/document.rb'
7
+ require 'rs4/configuration.rb'
8
+ require 'rs4/request_error.rb'
9
+ require 'rs4/reusable_template.rb'
10
+
11
+ module RS4
12
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RS4
2
4
  class << self
3
5
  attr_accessor :configuration
@@ -11,10 +13,5 @@ module RS4
11
13
  class Configuration
12
14
  attr_accessor :private_api_key
13
15
  attr_accessor :api_host
14
-
15
- def initialize
16
- @private_api_key = nil
17
- @api_host = nil
18
- end
19
16
  end
20
17
  end
@@ -87,7 +87,7 @@ module RS4
87
87
 
88
88
  path = "documents/#{document_guid}"
89
89
 
90
- response = RS4Api::Request.execute(path, :get)
90
+ response = RS4::Request.execute(path, :get)
91
91
 
92
92
  if response.class == Net::HTTPOK
93
93
  raw_document = JSON.parse(response.body, symbolize_names: true)
@@ -95,7 +95,7 @@ module RS4
95
95
  Document.new(raw_document[:document])
96
96
  else
97
97
  Rails.logger.error("Unable to get document #{document_guid}")
98
- RS4Api::RequestError.new(
98
+ RS4::RequestError.new(
99
99
  response.code,
100
100
  response.class,
101
101
  JSON.parse(response.read_body)
@@ -105,7 +105,7 @@ module RS4
105
105
 
106
106
  def get_documents
107
107
  path = 'documents'
108
- response = RS4Api::Request.execute(path, :get)
108
+ response = RS4::Request.execute(path, :get)
109
109
 
110
110
  if response.class == Net::HTTPOK
111
111
  documents = []
@@ -117,7 +117,7 @@ module RS4
117
117
  end
118
118
  else
119
119
  Rails.logger.error('Unable to get documents')
120
- RS4Api::RequestError.new(
120
+ RS4::RequestError.new(
121
121
  response.code,
122
122
  response.class,
123
123
  JSON.parse(response.read_body)
@@ -1,7 +1,3 @@
1
- require 'uri'
2
- require 'net/http'
3
- require 'openssl'
4
-
5
1
  module RS4
6
2
  # Prepares the HTTP request with the headers
7
3
  # required by the RS4 endpoints
@@ -0,0 +1,106 @@
1
+ module RS4
2
+ class ReusableTemplate
3
+ attr_accessor :id
4
+ attr_accessor :name
5
+ attr_accessor :creator
6
+ attr_accessor :expires_in
7
+ attr_accessor :signer_sequencing
8
+ attr_accessor :shared_with
9
+ attr_accessor :distribution_method
10
+ attr_accessor :identity_method
11
+ attr_accessor :kba
12
+ attr_accessor :passcode
13
+ attr_accessor :filename
14
+ attr_accessor :tags
15
+ attr_accessor :user_id
16
+ attr_accessor :roles
17
+ attr_accessor :merge_field_components
18
+ attr_accessor :created_at
19
+ attr_accessor :updated_at
20
+ attr_accessor :thumbnail_url
21
+ attr_accessor :page_image_urls
22
+
23
+ def initialize(options = {})
24
+ @id = options[:id]
25
+ @name = name
26
+ @creator = options[:creator]
27
+ @expires_in = options[:expires_in]
28
+ @signer_sequencing = options[:signer_sequencing]
29
+ @shared_with = options[:shared_with]
30
+ @distribution_method = options[:distribution_method]
31
+ @identity_method = options[:identity_method]
32
+ @kba = options[:kba]
33
+ @passcode = options[:passcode]
34
+ @filename = options[:filename]
35
+ @tags = options[:tags]
36
+ @user_id = options[:user_id]
37
+ @roles = options[:roles]
38
+ @merge_field_components = options[:merge_field_components]
39
+ @created_at = options[:created_at]
40
+ @updated_at = options[:updated_at]
41
+ @thumbnail_url = options[:thumbnail_url]
42
+ @page_image_urls = options[:page_image_urls]
43
+ end
44
+
45
+ class << self
46
+ def get_reusable_template(template_guid)
47
+ return unless template_guid
48
+
49
+ path = "reusable_templates/#{template_guid}"
50
+
51
+ response = RS4::Request.execute(path, :get)
52
+
53
+ if response.class == Net::HTTPOK
54
+ parsed_response = JSON.parse(response.read_body, symbolize_names: true)
55
+
56
+ template_hash = parsed_response[:reusable_template]
57
+
58
+ RS4::ReusableTemplate.new(template_hash)
59
+ else
60
+ RS4::RequestError.new(
61
+ response.code,
62
+ response.class,
63
+ JSON.parse(response.read_body)
64
+ )
65
+ end
66
+ end
67
+
68
+ def get_reusable_templates(options = {})
69
+ base_path = 'reusable_templates'
70
+
71
+ query = CGI.unescape(options.to_query)
72
+
73
+ path = query.empty? ? base_path : "#{base_path}?#{query}"
74
+
75
+ RS4::Request.execute(path, :get)
76
+ end
77
+
78
+ def send_document(template_guid, options = {})
79
+ path = "reusable_templates/#{template_guid}/send_document"
80
+
81
+ body = options
82
+
83
+ body[:in_person] = true
84
+
85
+ response = RS4::Request.execute(path, :post, body)
86
+
87
+ Rails.logger.info("RS4::ReusableTemplate::send_document:: #{response.inspect}")
88
+
89
+ if response.class == Net::HTTPOK
90
+ parsed_response = JSON.parse(response.read_body, symbolize_names: true)
91
+
92
+ document_hash = parsed_response[:document]
93
+
94
+ return RS4::Document.new(document_hash)
95
+
96
+ else
97
+ return RS4::RequestError.new(
98
+ response.code,
99
+ response.class,
100
+ JSON.parse(response.read_body)
101
+ )
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
@@ -1,3 +1,3 @@
1
1
  module RS4
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rs4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - donny
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-20 00:00:00.000000000 Z
11
+ date: 2020-06-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides ruby access to CRUD operations for RightSignature documents
14
14
  and reusable templates
@@ -27,11 +27,12 @@ files:
27
27
  - Rakefile
28
28
  - bin/console
29
29
  - bin/setup
30
- - lib/configuration.rb
31
- - lib/document.rb
32
- - lib/request.rb
33
- - lib/request_error.rb
34
- - lib/reusable_template.rb
30
+ - lib/rs4.rb
31
+ - lib/rs4/configuration.rb
32
+ - lib/rs4/document.rb
33
+ - lib/rs4/request.rb
34
+ - lib/rs4/request_error.rb
35
+ - lib/rs4/reusable_template.rb
35
36
  - lib/rs4/version.rb
36
37
  - license.txt
37
38
  - rs4.gemspec
@@ -1,104 +0,0 @@
1
- module RS4
2
- class ReusableTemplate
3
- attr_accessor :id
4
- attr_accessor :name
5
- attr_accessor :creator
6
- attr_accessor :expires_in
7
- attr_accessor :signer_sequencing
8
- attr_accessor :shared_with
9
- attr_accessor :distribution_method
10
- attr_accessor :identity_method
11
- attr_accessor :kba
12
- attr_accessor :passcode
13
- attr_accessor :filename
14
- attr_accessor :tags
15
- attr_accessor :user_id
16
- attr_accessor :roles
17
- attr_accessor :merge_field_components
18
- attr_accessor :created_at
19
- attr_accessor :updated_at
20
- attr_accessor :thumbnail_url
21
- attr_accessor :page_image_urls
22
-
23
- def initialize(options = {})
24
- @id = options[:id]
25
- @name = name
26
- @creator = options[:creator]
27
- @expires_in = options[:expires_in]
28
- @signer_sequencing = options[:signer_sequencing]
29
- @shared_with = options[:shared_with]
30
- @distribution_method = options[:distribution_method]
31
- @identity_method = options[:identity_method]
32
- @kba = options[:kba]
33
- @passcode = options[:passcode]
34
- @filename = options[:filename]
35
- @tags = options[:tags]
36
- @user_id = options[:user_id]
37
- @roles = options[:roles]
38
- @merge_field_components = options[:merge_field_components]
39
- @created_at = options[:created_at]
40
- @updated_at = options[:updated_at]
41
- @thumbnail_url = options[:thumbnail_url]
42
- @page_image_urls = options[:page_image_urls]
43
- end
44
-
45
- def get_reusable_template(template_guid)
46
- return unless template_guid
47
-
48
- path = "reusable_templates/#{template_guid}"
49
-
50
- response = RS4::Request.execute(path, :get)
51
-
52
- if response.class == Net::HTTPOK
53
- parsed_response = JSON.parse(response.read_body, symbolize_names: true)
54
-
55
- template_hash = parsed_response[:reusable_template]
56
-
57
- RS4Api::ReusableTemplate.new(template_hash)
58
- else
59
- RS4Api::RequestError.new(
60
- response.code,
61
- response.class,
62
- JSON.parse(response.read_body)
63
- )
64
- end
65
- end
66
-
67
- def get_reusable_templates(options = {})
68
- base_path = 'reusable_templates'
69
-
70
- query = CGI.unescape(options.to_query)
71
-
72
- path = query.empty? ? base_path : "#{base_path}?#{query}"
73
-
74
- RS4::Request.execute(path, :get)
75
- end
76
-
77
- def send_document(template_guid, options = {})
78
- path = "reusable_templates/#{template_guid}/send_document"
79
-
80
- body = options
81
-
82
- body[:in_person] = true
83
-
84
- response = RS4::Request.execute(path, :post, body)
85
-
86
- Rails.logger.info("RS4::ReusableTemplate::send_document:: #{response.inspect}")
87
-
88
- if response.class == Net::HTTPOK
89
- parsed_response = JSON.parse(response.read_body, symbolize_names: true)
90
-
91
- document_hash = parsed_response[:document]
92
-
93
- return RS4Api::Document.new(document_hash)
94
-
95
- else
96
- return RS4Api::RequestError.new(
97
- response.code,
98
- response.class,
99
- JSON.parse(response.read_body)
100
- )
101
- end
102
- end
103
- end
104
- end