rs4 0.1.5 → 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 +4 -4
- data/lib/rs4/reusable_template.rb +39 -37
- data/lib/rs4/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11e0ed8ace80f96d0ffde3b72915bfcd77c7eff73c47eb8682751e88b385755
|
4
|
+
data.tar.gz: cc830ddf9f7684734e687a6f85a17aa21726f1ca01bb45798a7c0ae5951087fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07928a830d6a935334c2ae13384c322beb41056cb4648f5905fbf7c2774de91fc0b338587d50719c6b8acffd101d086ea1dbf0e6e9276f6970ccd2058e8b9bf
|
7
|
+
data.tar.gz: 5ae429530d7eb69a6794d0458ee8c30ab28dec8499879bb4b4108977d8d4dc7025267fefd91337eff9ea0fe0885b02a0573ad37dec195129a38bf3705a8bd37a
|
@@ -42,62 +42,64 @@ module RS4
|
|
42
42
|
@page_image_urls = options[:page_image_urls]
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
class << self
|
46
|
+
def get_reusable_template(template_guid)
|
47
|
+
return unless template_guid
|
47
48
|
|
48
|
-
|
49
|
+
path = "reusable_templates/#{template_guid}"
|
49
50
|
|
50
|
-
|
51
|
+
response = RS4::Request.execute(path, :get)
|
51
52
|
|
52
|
-
|
53
|
-
|
53
|
+
if response.class == Net::HTTPOK
|
54
|
+
parsed_response = JSON.parse(response.read_body, symbolize_names: true)
|
54
55
|
|
55
|
-
|
56
|
+
template_hash = parsed_response[:reusable_template]
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
64
66
|
end
|
65
|
-
end
|
66
67
|
|
67
|
-
|
68
|
-
|
68
|
+
def get_reusable_templates(options = {})
|
69
|
+
base_path = 'reusable_templates'
|
69
70
|
|
70
|
-
|
71
|
+
query = CGI.unescape(options.to_query)
|
71
72
|
|
72
|
-
|
73
|
+
path = query.empty? ? base_path : "#{base_path}?#{query}"
|
73
74
|
|
74
|
-
|
75
|
-
|
75
|
+
RS4::Request.execute(path, :get)
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
78
|
+
def send_document(template_guid, options = {})
|
79
|
+
path = "reusable_templates/#{template_guid}/send_document"
|
79
80
|
|
80
|
-
|
81
|
+
body = options
|
81
82
|
|
82
|
-
|
83
|
+
body[:in_person] = true
|
83
84
|
|
84
|
-
|
85
|
+
response = RS4::Request.execute(path, :post, body)
|
85
86
|
|
86
|
-
|
87
|
+
Rails.logger.info("RS4::ReusableTemplate::send_document:: #{response.inspect}")
|
87
88
|
|
88
|
-
|
89
|
-
|
89
|
+
if response.class == Net::HTTPOK
|
90
|
+
parsed_response = JSON.parse(response.read_body, symbolize_names: true)
|
90
91
|
|
91
|
-
|
92
|
+
document_hash = parsed_response[:document]
|
92
93
|
|
93
|
-
|
94
|
+
return RS4::Document.new(document_hash)
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
else
|
97
|
+
return RS4::RequestError.new(
|
98
|
+
response.code,
|
99
|
+
response.class,
|
100
|
+
JSON.parse(response.read_body)
|
101
|
+
)
|
102
|
+
end
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|
data/lib/rs4/version.rb
CHANGED