Class: OFX::Header
- Inherits:
-
Object
- Object
- OFX::Header
- Defined in:
- lib/ofx/header.rb,
lib/ofx/1.0.2/header.rb
Overview
Summary
The OFX headers for one message. The headers provide metadata about the OFX request/response, including message versioning, security, and encoding.
Specifications
- OFX 1.0.2
-
2.2 (pp. 12-14)
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#compression ⇒ Object
- OFX 1.0.2
-
2.2.6.
- #compression=(value) ⇒ Object
-
#content_character_set ⇒ Object
- OFX 1.0.2
-
2.2.5.
- #content_character_set=(value) ⇒ Object
-
#content_encoding ⇒ Object
- OFX 1.0.2
-
2.2.5.
- #content_encoding=(value) ⇒ Object
-
#content_type ⇒ Object
- OFX 1.0.2
-
2.2.2.
- #content_type=(value) ⇒ Object
-
#document_version ⇒ Object
- OFX 1.0.2
-
2.2.3.
- #document_version=(value) ⇒ Object
-
#header_version ⇒ Object
- The version of this OFX header OFX 1.0.2
- 2.2.1 OFX 1.0.3
-
2.2.1.
- #header_version=(value) ⇒ Object
-
#initialize ⇒ Header
constructor
A new instance of Header.
-
#previous_unique_identifier ⇒ Object
- OFX 1.0.2
-
2.2.7.
- #previous_unique_identifier=(value) ⇒ Object
-
#security ⇒ Object
- OFX 1.0.2
-
2.2.4.
- #security=(value) ⇒ Object
- #to_ofx_102_s ⇒ Object
-
#unique_identifier ⇒ Object
- OFX 1.0.2
-
2.2.7.
- #unique_identifier=(value) ⇒ Object
Constructor Details
#initialize ⇒ Header
Returns a new instance of Header.
29 30 31 |
# File 'lib/ofx/header.rb', line 29 def initialize @headers = {} end |
Class Method Details
.from_ofx_102_s(header_string) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ofx/1.0.2/header.rb', line 36 def self.from_ofx_102_s(header_string) header = OFX::Header.new header_pattern = /^(\w+)\:(.*)$/ header_string.split(%r{\r*\n}).each do |this_header| header_match = header_pattern.match(this_header) header[header_match[1]] = header_match[2] end header end |
Instance Method Details
#[](key) ⇒ Object
33 34 35 |
# File 'lib/ofx/header.rb', line 33 def [](key) @headers[key] end |
#[]=(key, value) ⇒ Object
37 38 39 |
# File 'lib/ofx/header.rb', line 37 def []=(key, value) @headers[key] = value end |
#compression ⇒ Object
- OFX 1.0.2
-
2.2.6
92 93 94 |
# File 'lib/ofx/header.rb', line 92 def compression @headers['COMPRESSION'] end |
#compression=(value) ⇒ Object
95 96 97 |
# File 'lib/ofx/header.rb', line 95 def compression=(value) @headers['COMPRESSION'] = value end |
#content_character_set ⇒ Object
- OFX 1.0.2
-
2.2.5
84 85 86 |
# File 'lib/ofx/header.rb', line 84 def content_character_set @headers['CHARSET'] end |
#content_character_set=(value) ⇒ Object
87 88 89 |
# File 'lib/ofx/header.rb', line 87 def content_character_set=(value) @headers['CHARSET'] = value end |
#content_encoding ⇒ Object
- OFX 1.0.2
-
2.2.5
76 77 78 |
# File 'lib/ofx/header.rb', line 76 def content_encoding @headers['ENCODING'] end |
#content_encoding=(value) ⇒ Object
79 80 81 |
# File 'lib/ofx/header.rb', line 79 def content_encoding=(value) @headers['ENCODING'] = value end |
#content_type ⇒ Object
- OFX 1.0.2
-
2.2.2
52 53 54 |
# File 'lib/ofx/header.rb', line 52 def content_type @headers['DATA'] end |
#content_type=(value) ⇒ Object
55 56 57 |
# File 'lib/ofx/header.rb', line 55 def content_type=(value) @headers['DATA'] = value end |
#document_version ⇒ Object
- OFX 1.0.2
-
2.2.3
60 61 62 |
# File 'lib/ofx/header.rb', line 60 def document_version OFX::Version.new(@headers['VERSION']) end |
#document_version=(value) ⇒ Object
63 64 65 |
# File 'lib/ofx/header.rb', line 63 def document_version=(value) @headers['VERSION'] = value end |
#header_version ⇒ Object
The version of this OFX header
- OFX 1.0.2
-
2.2.1
- OFX 1.0.3
-
2.2.1
44 45 46 |
# File 'lib/ofx/header.rb', line 44 def header_version OFX::Version.new(@headers['OFXHEADER']) end |
#header_version=(value) ⇒ Object
47 48 49 |
# File 'lib/ofx/header.rb', line 47 def header_version=(value) @headers['OFXHEADER'] = value end |
#previous_unique_identifier ⇒ Object
- OFX 1.0.2
-
2.2.7
108 109 110 |
# File 'lib/ofx/header.rb', line 108 def previous_unique_identifier @headers['OLDFILEUID'] end |
#previous_unique_identifier=(value) ⇒ Object
111 112 113 |
# File 'lib/ofx/header.rb', line 111 def previous_unique_identifier=(value) @headers['OLDFILEUID'] = value end |
#security ⇒ Object
- OFX 1.0.2
-
2.2.4
68 69 70 |
# File 'lib/ofx/header.rb', line 68 def security @headers['SECURITY'] end |
#security=(value) ⇒ Object
71 72 73 |
# File 'lib/ofx/header.rb', line 71 def security=(value) @headers['SECURITY'] = value end |
#to_ofx_102_s ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ofx/1.0.2/header.rb', line 20 def to_ofx_102_s headers = "" headers += "OFXHEADER:" + self.header_version.to_compact_s + "\n" headers += "DATA:" + self.content_type.to_s + "\n" headers += "VERSION:" + self.document_version.to_compact_s + "\n" headers += "SECURITY:" + self.security.to_s + "\n" headers += "ENCODING:" + self.content_encoding.to_s + "\n" headers += "CHARSET:" + self.content_character_set.to_s + "\n" headers += "COMPRESSION:" + self.compression.to_s + "\n" headers += "OLDFILEUID:" + self.previous_unique_identifier.to_s + "\n" headers += "NEWFILEUID:" + self.unique_identifier.to_s + "\n" headers end |
#unique_identifier ⇒ Object
- OFX 1.0.2
-
2.2.7
100 101 102 |
# File 'lib/ofx/header.rb', line 100 def unique_identifier @headers['NEWFILEUID'] end |
#unique_identifier=(value) ⇒ Object
103 104 105 |
# File 'lib/ofx/header.rb', line 103 def unique_identifier=(value) @headers['NEWFILEUID'] = value end |