adf_builder 0.1.0 → 0.2.2

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: b644015171eb06c074f83a92dea4dc76afc3ce88a378672f5878298dff8f2ed2
4
- data.tar.gz: 74c51e26810654ff1294c0b2d910c4d3a6efc68af43f5f24d9d8e0ef801a7425
3
+ metadata.gz: a27353d159fc18c45473200eb92b6113479e81d0e1e510649bac29fcdcc54522
4
+ data.tar.gz: b5613f09c70d8e636f1c1698b7faf6fabe4841bb4dbd72d4f7077cdb880b86c2
5
5
  SHA512:
6
- metadata.gz: da0a22f6aa9d1fbf0a37eefdf0d4ae51cd1802379d55031523857c04c801d67de8fb180741b1bbbcf33dd92c6868e88578707de170da851e1e60034dec0b21a4
7
- data.tar.gz: e571e9fc599d480f74d2b2a6754c4aecf2bfb7a4cc672caed42c91ced09392a58502d94a3d0b4912f2b90d8aa12724635f59083ac1fdecce6e6ebddd2c5e557d
6
+ metadata.gz: 6fc9c5273a6ad3453284114c898108ed19395e87b9772ad67218b476725675a58e42781cc7e24860064e1bb4c7dd743ca8e39a9f2f7ac3f198e4df04010327df
7
+ data.tar.gz: 5536658b81a4f0d11c9cde8ddb666125d7a80f696ec74e98912d8c9e69bfaad930faf773d85ecbf55c3d39e8e8d68f7753e91d39868cb10656446c980c144b48
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
  .idea
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ build.txt
data/CHANGELOG.md CHANGED
@@ -7,6 +7,9 @@
7
7
  - Contact
8
8
  - Vehicle
9
9
 
10
+ ## [0.2.1] - 2021-11-02
11
+ - Add comments to the Vehicle nodes
12
+
10
13
  ## [0.1.0] - 2021-08-13
11
14
  - Figured out versioning I think
12
15
  - Add Price structure to vehicles
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adf_builder (0.1.0)
4
+ adf_builder (0.2.2)
5
5
  ox (~> 2.14)
6
6
 
7
7
  GEM
@@ -46,6 +46,7 @@ GEM
46
46
 
47
47
  PLATFORMS
48
48
  arm64-darwin-20
49
+ arm64-darwin-22
49
50
 
50
51
  DEPENDENCIES
51
52
  adf_builder!
@@ -55,4 +56,4 @@ DEPENDENCIES
55
56
  rubocop (~> 1.7)
56
57
 
57
58
  BUNDLED WITH
58
- 2.2.25
59
+ 2.4.4
data/README.md CHANGED
@@ -356,6 +356,37 @@ Outputs
356
356
  </adf>
357
357
  ```
358
358
 
359
+ Adding comments to Vehicle
360
+ ```ruby
361
+ builder = AdfBuilder::Builder.new
362
+ builder.prospect.vehicles.add(2021, 'Toyota', 'Prius', {
363
+ status: :used,
364
+ })
365
+
366
+ builder.prospect.vehicles.add_comments(0, "This is a comment")
367
+
368
+ puts builder.to_xml
369
+ ```
370
+
371
+ Outputs
372
+ ```xml
373
+ <?ADF version="1.0"?>
374
+
375
+ <?xml version="1.0"?>
376
+ <adf>
377
+ <prospect status="new">
378
+ <requestdate>2021-11-02T16:35:43+04:00</requestdate>
379
+ <customer/>
380
+ <vendor/>
381
+ <vehicle status="used">
382
+ <year>2021</year>
383
+ <make>Toyota</make>
384
+ <model>Prius</model>
385
+ <comments>This is a comment</comments>
386
+ </vehicle>
387
+ </prospect>
388
+ </adf>
389
+ ```
359
390
  ## Development
360
391
 
361
392
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -112,5 +112,12 @@ module AdfBuilder
112
112
  @prices.push(price)
113
113
  end
114
114
  end
115
+
116
+ def add_comments(index, value)
117
+ valid, vehicle = AdfBuilder::Builder.valid_child?(@prospect,'vehicle', index)
118
+ if valid
119
+ AdfBuilder::Builder.update_node(vehicle, 'comments', value)
120
+ end
121
+ end
115
122
  end
116
123
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AdfBuilder
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.2"
5
5
  end
data/lib/adf_builder.rb CHANGED
@@ -102,11 +102,11 @@ module AdfBuilder
102
102
  # all the files will start with this same header
103
103
  def init_doc
104
104
  doc = Ox::Document.new
105
- instruct = Ox::Instruct.new('ADF')
105
+ instruct = Ox::Instruct.new(:xml)
106
106
  instruct[:version] = '1.0'
107
107
  doc << instruct
108
- doc << Ox::Raw.new("\n")
109
- instruct = Ox::Instruct.new(:xml)
108
+ doc << Ox::Raw.new("")
109
+ instruct = Ox::Instruct.new('ADF')
110
110
  instruct[:version] = '1.0'
111
111
  doc << instruct
112
112
  adf = Ox::Element.new("adf")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adf_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - marcus.salinas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-13 00:00:00.000000000 Z
11
+ date: 2023-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.1.4
83
+ rubygems_version: 3.1.6
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Create XML for the Auto-base Date Format