adf_builder 0.2.2 → 0.3.0

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: a27353d159fc18c45473200eb92b6113479e81d0e1e510649bac29fcdcc54522
4
- data.tar.gz: b5613f09c70d8e636f1c1698b7faf6fabe4841bb4dbd72d4f7077cdb880b86c2
3
+ metadata.gz: 22d08bb10c44efbd81470a2623878e2d168edde0fe1255872b1b24cc80f0b484
4
+ data.tar.gz: 3a367084f65bd676bea7bc40ced1ae75987984e687e3c44c5ac64f3844439f63
5
5
  SHA512:
6
- metadata.gz: 6fc9c5273a6ad3453284114c898108ed19395e87b9772ad67218b476725675a58e42781cc7e24860064e1bb4c7dd743ca8e39a9f2f7ac3f198e4df04010327df
7
- data.tar.gz: 5536658b81a4f0d11c9cde8ddb666125d7a80f696ec74e98912d8c9e69bfaad930faf773d85ecbf55c3d39e8e8d68f7753e91d39868cb10656446c980c144b48
6
+ metadata.gz: ccd4ff42b0718572645eaf571ec0f42212b30b7017875afb6ac273cf61d286ca7045d64b084a4ee4b3ef10413130a8176aea983d64a7850dddca260c458b8795
7
+ data.tar.gz: 2eebf6109af2c803ad2fce7c46744a0f6ec3f91af8405e413bfcbd2e0ce5f4f483d617f2e69c87b67c07a62c087a5a226095b79f10d39a9e36b60356e90f15cd
data/.gitignore CHANGED
@@ -10,4 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
 
13
- build.txt
13
+ deploy.txt
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@
7
7
  - Contact
8
8
  - Vehicle
9
9
 
10
+ ## [0.3.0] - 2023-11-28
11
+ - Completed Customer - timeframe and comments tags
12
+
13
+ ## [0.2.2] - 2021-11-02
14
+ - Fixed bug where ADF and xml tags were flipped
15
+
10
16
  ## [0.2.1] - 2021-11-02
11
17
  - Add comments to the Vehicle nodes
12
18
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adf_builder (0.2.2)
4
+ adf_builder (0.3.0)
5
5
  ox (~> 2.14)
6
6
 
7
7
  GEM
@@ -3,6 +3,7 @@ module AdfBuilder
3
3
  def initialize(prospect)
4
4
  @customer = Ox::Element.new('customer')
5
5
  @contact = nil
6
+ @timeframe = nil
6
7
 
7
8
  prospect << @customer
8
9
  end
@@ -11,6 +12,9 @@ module AdfBuilder
11
12
  @contact
12
13
  end
13
14
 
15
+ def timeframe
16
+ @timeframe
17
+ end
14
18
  def add(name, opts={})
15
19
  @contact = Contact.new(@customer, name, opts)
16
20
  end
@@ -23,5 +27,32 @@ module AdfBuilder
23
27
  end
24
28
  end
25
29
 
30
+ # @param descriptin [String] - Description of customer’s timing intention.
31
+ # @param earliest_date [DateTime] - Earliest date customer is interested in. If timeframe tag
32
+ # is present, it is required to specify earliestdate and/or
33
+ # latestdate
34
+ # @param latest_date [DateTime] - Latest date customer is interested in. If timeframe tag
35
+ # is present, it is required to specify earliestdate and/or
36
+ # latestdate
37
+ def add_timeframe(description, earliest_date=nil, latest_date=nil)
38
+ if earliest_date.nil? and latest_date.nil?
39
+ return false
40
+ end
41
+
42
+ if earliest_date and earliest_date.class != DateTime
43
+ return false
44
+ end
45
+
46
+ if latest_date and latest_date.class != DateTime
47
+ return false
48
+ end
49
+
50
+ @timeframe = Timeframe.new(@customer, description, earliest_date, latest_date) if @timeframe.nil?
51
+ end
52
+
53
+ def update_comments(comments)
54
+ return false if comments.class != String
55
+ AdfBuilder::Builder.update_node(@customer, :comments, comments)
56
+ end
26
57
  end
27
58
  end
@@ -0,0 +1,44 @@
1
+ module AdfBuilder
2
+ class Timeframe
3
+ def initialize(customer, description, earliest_date, latest_date)
4
+
5
+ begin
6
+ earliest_date = earliest_date.strftime('%FT%T%:z') if earliest_date
7
+ latest_date = latest_date.strftime('%FT%T%:z') if latest_date
8
+ rescue => e
9
+ return nil
10
+ end
11
+
12
+ @timeframe = Ox::Element.new('timeframe')
13
+
14
+
15
+ @timeframe << (Ox::Element.new('description') << description)
16
+ @timeframe << (Ox::Element.new('earliestdate') << earliest_date) if earliest_date
17
+ @timeframe << (Ox::Element.new('latestdate') << latest_date) if latest_date
18
+ customer << @timeframe
19
+ end
20
+
21
+ def update_description(description)
22
+ AdfBuilder::Builder.update_node(@timeframe, :description, description)
23
+ end
24
+
25
+ def update_earliest_date(date)
26
+ begin
27
+ date = date.strftime('%FT%T%:z')
28
+ rescue
29
+ return false
30
+ end
31
+ AdfBuilder::Builder.update_node(@timeframe, :earliestdate, date)
32
+ end
33
+
34
+ def update_latest_date(date)
35
+ begin
36
+ date = date.strftime('%FT%T%:z')
37
+ rescue
38
+ return false
39
+ end
40
+
41
+ AdfBuilder::Builder.update_node(@timeframe, :latestdate, date)
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AdfBuilder
4
- VERSION = "0.2.2"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/adf_builder.rb CHANGED
@@ -7,6 +7,7 @@ require_relative "adf_builder/version"
7
7
 
8
8
  # CUSTOMER
9
9
  require_relative 'adf_builder/customer/customer'
10
+ require_relative 'adf_builder/customer/timeframe'
10
11
 
11
12
  # BASE
12
13
  require_relative 'adf_builder/base/base'
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.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - marcus.salinas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-05 00:00:00.000000000 Z
11
+ date: 2023-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox
@@ -49,6 +49,7 @@ files:
49
49
  - lib/adf_builder/base/prospect.rb
50
50
  - lib/adf_builder/base/request_date.rb
51
51
  - lib/adf_builder/customer/customer.rb
52
+ - lib/adf_builder/customer/timeframe.rb
52
53
  - lib/adf_builder/data/iso-4217-currency-codes.json
53
54
  - lib/adf_builder/provider/provider.rb
54
55
  - lib/adf_builder/shared/contact.rb