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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23c0458d33cdeff50946463cabf059af6303f5e109e6b3d1b3a320ef3d31dd72
4
- data.tar.gz: 5148a81842c3de6a3b54d2d5b8d8df44faada800eb1ab7a0709f9be03a297479
3
+ metadata.gz: d11e0ed8ace80f96d0ffde3b72915bfcd77c7eff73c47eb8682751e88b385755
4
+ data.tar.gz: cc830ddf9f7684734e687a6f85a17aa21726f1ca01bb45798a7c0ae5951087fc
5
5
  SHA512:
6
- metadata.gz: 224653c586d33495acc5e5e1bfbec5356409a8a4457740f92f796d8c3c373b5933c99128ebaab07450b653ae7efa5c932da74aa23b45948bb733165a8f8fd11b
7
- data.tar.gz: 79b467f38c8a43c3ca3fa32932aea5f8015e8ae734e8b4e53be9dbcaf7da59912f9968aaee6af5b396238fa217695c877ff4d9b5d3e9cda1ea4c1db1a43f5040
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
- def get_reusable_template(template_guid)
46
- return unless template_guid
45
+ class << self
46
+ def get_reusable_template(template_guid)
47
+ return unless template_guid
47
48
 
48
- path = "reusable_templates/#{template_guid}"
49
+ path = "reusable_templates/#{template_guid}"
49
50
 
50
- response = RS4::Request.execute(path, :get)
51
+ response = RS4::Request.execute(path, :get)
51
52
 
52
- if response.class == Net::HTTPOK
53
- parsed_response = JSON.parse(response.read_body, symbolize_names: true)
53
+ if response.class == Net::HTTPOK
54
+ parsed_response = JSON.parse(response.read_body, symbolize_names: true)
54
55
 
55
- template_hash = parsed_response[:reusable_template]
56
+ template_hash = parsed_response[:reusable_template]
56
57
 
57
- RS4::ReusableTemplate.new(template_hash)
58
- else
59
- RS4::RequestError.new(
60
- response.code,
61
- response.class,
62
- JSON.parse(response.read_body)
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
- def get_reusable_templates(options = {})
68
- base_path = 'reusable_templates'
68
+ def get_reusable_templates(options = {})
69
+ base_path = 'reusable_templates'
69
70
 
70
- query = CGI.unescape(options.to_query)
71
+ query = CGI.unescape(options.to_query)
71
72
 
72
- path = query.empty? ? base_path : "#{base_path}?#{query}"
73
+ path = query.empty? ? base_path : "#{base_path}?#{query}"
73
74
 
74
- RS4::Request.execute(path, :get)
75
- end
75
+ RS4::Request.execute(path, :get)
76
+ end
76
77
 
77
- def send_document(template_guid, options = {})
78
- path = "reusable_templates/#{template_guid}/send_document"
78
+ def send_document(template_guid, options = {})
79
+ path = "reusable_templates/#{template_guid}/send_document"
79
80
 
80
- body = options
81
+ body = options
81
82
 
82
- body[:in_person] = true
83
+ body[:in_person] = true
83
84
 
84
- response = RS4::Request.execute(path, :post, body)
85
+ response = RS4::Request.execute(path, :post, body)
85
86
 
86
- Rails.logger.info("RS4::ReusableTemplate::send_document:: #{response.inspect}")
87
+ Rails.logger.info("RS4::ReusableTemplate::send_document:: #{response.inspect}")
87
88
 
88
- if response.class == Net::HTTPOK
89
- parsed_response = JSON.parse(response.read_body, symbolize_names: true)
89
+ if response.class == Net::HTTPOK
90
+ parsed_response = JSON.parse(response.read_body, symbolize_names: true)
90
91
 
91
- document_hash = parsed_response[:document]
92
+ document_hash = parsed_response[:document]
92
93
 
93
- return RS4::Document.new(document_hash)
94
+ return RS4::Document.new(document_hash)
94
95
 
95
- else
96
- return RS4::RequestError.new(
97
- response.code,
98
- response.class,
99
- JSON.parse(response.read_body)
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
@@ -1,3 +1,3 @@
1
1
  module RS4
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rs4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - donny