rightmove_blm 0.2.7 → 0.2.9
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/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/rightmove_blm/document.rb +4 -3
- data/lib/rightmove_blm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d70db570f43e185093f999f4463fd012c0c4a4f1de18d5650b4e2a138d5c3b
|
4
|
+
data.tar.gz: 88cb21e69f2f9d6f2b36b52344011994e93769bc18e51cace0d7cd9b71dca6b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b6b2f69ff9c9a8faeded42dc79f74149a490a32bbfdb4273542c2e0d2d3ce897a037a913092235bf17fb4bfff82353036b0580eb9ce5f7ab93208a2cb889e29
|
7
|
+
data.tar.gz: 83ca8d3b612f8a15866f5c6bb0c29b47e60610137192c1f4470a49850a276d899dc35d3ed20912e590e82f3e0eb3724f13c149f57800d6139b944ae1da64afbf
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -68,3 +68,9 @@ The keys from the first _hash_ in the provided _array_ are used to provide the f
|
|
68
68
|
document = RightmoveBLM::Document.from_array_of_hashes([{ field1: 'foo', field2: 'bar' }, { field1: 'baz', field2: 'foobar' }])
|
69
69
|
File.write('my_data.blm', document.to_blm)
|
70
70
|
```
|
71
|
+
|
72
|
+
To generate a Rightmove document with version 3i, provide `true` for the optional parameter `international`.
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
document = RightmoveBLM::Document.from_array_of_hashes([{ field1: 'foo', field2: 'bar' }, { field1: 'baz', field2: 'foobar' }], international: true)
|
76
|
+
```
|
@@ -5,9 +5,10 @@ module RightmoveBLM
|
|
5
5
|
class Document # rubocop:disable Metrics/ClassLength
|
6
6
|
BLM_FILE_SECTIONS = %w[HEADER DEFINITION DATA END].freeze
|
7
7
|
|
8
|
-
def self.from_array_of_hashes(array)
|
8
|
+
def self.from_array_of_hashes(array, international: false)
|
9
9
|
date = Time.now.utc.strftime('%d-%b-%Y %H:%M').upcase
|
10
|
-
|
10
|
+
version = international ? '3i' : '3'
|
11
|
+
header = { version: version, eof: '^', eor: '~', 'property count': array.size.to_s, 'generated date': date }
|
11
12
|
new(header: header, definition: array.first.keys.map(&:to_sym), data: array)
|
12
13
|
end
|
13
14
|
|
@@ -78,7 +79,7 @@ module RightmoveBLM
|
|
78
79
|
end
|
79
80
|
|
80
81
|
def international?
|
81
|
-
%w[H1 3I].include?(version)
|
82
|
+
%w[H1 3I 3i].include?(version)
|
82
83
|
end
|
83
84
|
|
84
85
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rightmove_blm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Parse and generate Rightmove BLM files
|
14
14
|
email: git@bob.frl
|