Class: RsrGroup::ResponseFile
- Defined in:
- lib/rsr_group/response_file.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
(also: #get_content)
readonly
Returns the value of attribute content.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ResponseFile
constructor
A new instance of ResponseFile.
- #response_type ⇒ Object
- #to_json ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ ResponseFile
Returns a new instance of ResponseFile.
8 9 10 11 12 13 |
# File 'lib/rsr_group/response_file.rb', line 8 def initialize( = {}) requires!(, :username, :password, :filename) @credentials = .select { |k, v| [:username, :password].include?(k) } @filename = [:filename] end |
Instance Attribute Details
#content ⇒ Object (readonly) Also known as: get_content
Returns the value of attribute content.
4 5 6 |
# File 'lib/rsr_group/response_file.rb', line 4 def content @content end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/rsr_group/response_file.rb', line 5 def filename @filename end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/rsr_group/response_file.rb', line 6 def @timestamp end |
Class Method Details
Instance Method Details
#response_type ⇒ Object
44 45 46 |
# File 'lib/rsr_group/response_file.rb', line 44 def response_type FILE_TYPES[@filename.split("-").first] end |
#to_json ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rsr_group/response_file.rb', line 48 def to_json get_content @json = { response_type: response_type, identifier: @content.lines[1].split(";")[0] } return parse_eerr if error? return parse_econf if confirmation? return parse_eship if shipping? end |