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 +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/adf_builder/customer/customer.rb +31 -0
- data/lib/adf_builder/customer/timeframe.rb +44 -0
- data/lib/adf_builder/version.rb +1 -1
- data/lib/adf_builder.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22d08bb10c44efbd81470a2623878e2d168edde0fe1255872b1b24cc80f0b484
|
4
|
+
data.tar.gz: 3a367084f65bd676bea7bc40ced1ae75987984e687e3c44c5ac64f3844439f63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccd4ff42b0718572645eaf571ec0f42212b30b7017875afb6ac273cf61d286ca7045d64b084a4ee4b3ef10413130a8176aea983d64a7850dddca260c458b8795
|
7
|
+
data.tar.gz: 2eebf6109af2c803ad2fce7c46744a0f6ec3f91af8405e413bfcbd2e0ce5f4f483d617f2e69c87b67c07a62c087a5a226095b79f10d39a9e36b60356e90f15cd
|
data/.gitignore
CHANGED
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
@@ -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
|
data/lib/adf_builder/version.rb
CHANGED
data/lib/adf_builder.rb
CHANGED
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.
|
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-
|
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
|