adf_builder 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -10
- data/Gemfile.lock +1 -1
- data/README.md +41 -1
- data/lib/adf_builder.rb +3 -0
- data/lib/adf_builder/base/prospect.rb +5 -0
- data/lib/adf_builder/provider/provider.rb +55 -0
- data/lib/adf_builder/shared/contact.rb +25 -33
- data/lib/adf_builder/version.rb +1 -1
- 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: 8a2725ac72b47a548355664e21014fd434ead3aa0829f0dfd3d8c506dd12c1db
|
4
|
+
data.tar.gz: 584cabe276de7ef15cecc2e50911005e6a7100468582934f3efa97107d5d576b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a4e274b4ea6af2af31d0cec8c6c452ff8da5db67b8f4c3b9442a0d44449dbf912e6b6ad1146649f12b7b8a20017716598e56b01e19f5ebb17020aa94ee57faf
|
7
|
+
data.tar.gz: b7c13eab73118e95fe03af6c1428c01f18a69c895ef2d48d4eda9731289353857d210328f08150818d27141e332bace07ff6c991c482d6063526939beca3e492
|
data/CHANGELOG.md
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
## [Unreleased]
|
2
|
-
- Vehicle Structure
|
3
|
-
- Remaining Optional Tags that are not free text
|
4
|
-
- odometer
|
5
|
-
- condition
|
6
|
-
- colorcombination
|
7
|
-
- imagetag
|
2
|
+
- Vehicle Structure - Remaining Optional Tags that are not free text
|
8
3
|
- price
|
9
4
|
- option
|
10
5
|
- finance
|
11
6
|
- Expand Structures for all parameters
|
12
7
|
- Customer
|
13
|
-
- Vehicle
|
14
8
|
- Contact
|
9
|
+
- Vehicle
|
10
|
+
- Price
|
11
|
+
|
15
12
|
|
16
|
-
|
17
|
-
-
|
18
|
-
- Add Price structure
|
13
|
+
## [0.0.8] - 2021-08-12
|
14
|
+
- Added all of Provider structure
|
19
15
|
|
20
16
|
## [0.0.7] - 2021-08-08
|
21
17
|
- Much refactoring so that we can reuse functions
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -251,8 +251,48 @@ Outputs
|
|
251
251
|
</prospect>
|
252
252
|
</adf>
|
253
253
|
```
|
254
|
+
A complex Provider
|
254
255
|
|
255
|
-
|
256
|
+
```ruby
|
257
|
+
builder = AdfBuilder::Builder.new
|
258
|
+
provider = builder.prospect.provider
|
259
|
+
provider.add('Testing', {part: 'full', type: 'business'})
|
260
|
+
provider.update_tags_with_free_text({
|
261
|
+
url: 'howdy',
|
262
|
+
service: "Nice"
|
263
|
+
})
|
264
|
+
provider.add_email("test@test.com", {preferredcontact: 0})
|
265
|
+
provider.add_phone("+14445556666", {
|
266
|
+
type: 'fax',
|
267
|
+
time: 'day'
|
268
|
+
})
|
269
|
+
provider.add_contact("Mr Sir")
|
270
|
+
provider.contact.add_phone("+132435523424")
|
271
|
+
```
|
272
|
+
|
273
|
+
```xml
|
274
|
+
<?ADF version="1.0"?>
|
275
|
+
|
276
|
+
<?xml version="1.0"?>
|
277
|
+
<adf>
|
278
|
+
<prospect status="new">
|
279
|
+
<requestdate>2021-08-12T18:56:41+04:00</requestdate>
|
280
|
+
<customer/>
|
281
|
+
<vendor/>
|
282
|
+
<provider>
|
283
|
+
<name part="full" type="business">Testing</name>
|
284
|
+
<url>howdy</url>
|
285
|
+
<service>Nice</service>
|
286
|
+
<email preferredcontact="0">test@test.com</email>
|
287
|
+
<phone type="fax" time="day">+14445556666</phone>
|
288
|
+
<contact>
|
289
|
+
<name>Mr Sir</name>
|
290
|
+
<phone>+132435523424</phone>
|
291
|
+
</contact>
|
292
|
+
</provider>
|
293
|
+
</prospect>
|
294
|
+
</adf>
|
295
|
+
```
|
256
296
|
|
257
297
|
## Development
|
258
298
|
|
data/lib/adf_builder.rb
CHANGED
@@ -11,6 +11,9 @@ require_relative 'adf_builder/base/base'
|
|
11
11
|
require_relative 'adf_builder/base/prospect'
|
12
12
|
require_relative 'adf_builder/base/request_date'
|
13
13
|
|
14
|
+
# PROVIDER
|
15
|
+
require_relative 'adf_builder/provider/provider'
|
16
|
+
|
14
17
|
# SHARED
|
15
18
|
require_relative 'adf_builder/shared/id'
|
16
19
|
require_relative 'adf_builder/shared/contact'
|
@@ -16,6 +16,7 @@ module AdfBuilder
|
|
16
16
|
@vehicles = Vehicles.new(@prospect)
|
17
17
|
@customer = Customer.new(@prospect)
|
18
18
|
@vendor = Vendor.new(@prospect)
|
19
|
+
@provider = Provider.new(@prospect)
|
19
20
|
end
|
20
21
|
|
21
22
|
def request_date
|
@@ -34,6 +35,10 @@ module AdfBuilder
|
|
34
35
|
@vendor
|
35
36
|
end
|
36
37
|
|
38
|
+
def provider
|
39
|
+
@provider
|
40
|
+
end
|
41
|
+
|
37
42
|
# set status to renew
|
38
43
|
def set_renew
|
39
44
|
@prospect[:status] = STATUSES[:resend]
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module AdfBuilder
|
2
|
+
class Provider
|
3
|
+
|
4
|
+
|
5
|
+
FREE_TEXT_OPTIONAL_TAGS = [:service, :url]
|
6
|
+
|
7
|
+
def initialize(prospect)
|
8
|
+
@prospect = prospect
|
9
|
+
@provider = nil
|
10
|
+
@contact = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def contact
|
14
|
+
@contact
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def add(name, params={})
|
19
|
+
@provider = Ox::Element.new('provider')
|
20
|
+
params.merge!({valid_values: AdfBuilder::Contact::VALID_VALUES, valid_parameters: AdfBuilder::Contact::VALID_PARAMETERS})
|
21
|
+
AdfBuilder::Builder.update_node(@provider, :name, name, params)
|
22
|
+
@prospect << @provider
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_contact(name, opts={})
|
26
|
+
@contact = Contact.new(@provider, name, opts)
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_phone(phone, params={})
|
30
|
+
params.merge!({valid_values: AdfBuilder::Contact::VALID_VALUES, valid_parameters: AdfBuilder::Contact::VALID_PARAMETERS})
|
31
|
+
AdfBuilder::Builder.update_node(@provider, :phone, phone, params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_email(email, params={})
|
35
|
+
params.merge!({valid_values: AdfBuilder::Contact::VALID_VALUES, valid_parameters: AdfBuilder::Contact::VALID_PARAMETERS})
|
36
|
+
AdfBuilder::Builder.update_node(@provider, :email, email, params)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_tags_with_free_text(tags)
|
40
|
+
tags.each do |key, value|
|
41
|
+
if FREE_TEXT_OPTIONAL_TAGS.include? key.to_sym
|
42
|
+
AdfBuilder::Builder.update_node(@provider, key, value)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_id(index, value, source=nil, sequence=1)
|
48
|
+
if @prospect.locate("provider").empty?
|
49
|
+
false
|
50
|
+
else
|
51
|
+
Id.new.add(@prospect.provider(index), value, source, sequence)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -6,45 +6,37 @@ module AdfBuilder
|
|
6
6
|
phone: [:type, :time, :preferredcontact]
|
7
7
|
}
|
8
8
|
|
9
|
-
|
9
|
+
VALID_VALUES = {
|
10
|
+
name: {
|
11
|
+
part: %w[first middle suffix last full],
|
12
|
+
type: %w[individual business],
|
13
|
+
primarycontact: %w[0 1]
|
14
|
+
},
|
15
|
+
email: {
|
16
|
+
preferredcontact: %w[0 1],
|
17
|
+
},
|
18
|
+
phone: {
|
19
|
+
preferredcontact: %w[0 1],
|
20
|
+
type: %w[phone fax cellphone pager],
|
21
|
+
time: %w[morning afternoon evening nopreference day]
|
22
|
+
}
|
23
|
+
}
|
10
24
|
|
11
|
-
def initialize(parent_node, name,
|
12
|
-
@contact = Ox::Element.new('contact')
|
25
|
+
def initialize(parent_node, name, params={})
|
26
|
+
@contact = Ox::Element.new('contact')
|
27
|
+
params.merge!({valid_values: VALID_VALUES, valid_parameters: VALID_PARAMETERS})
|
28
|
+
AdfBuilder::Builder.update_node(@contact, :name, name, params)
|
13
29
|
parent_node << @contact
|
14
|
-
|
15
|
-
opts = whitelabel_opts(opts, :name)
|
16
|
-
|
17
|
-
if opts[:primary_contact]
|
18
|
-
@contact[:primarycontact] = opts[:primary_contact].to_s
|
19
|
-
end
|
20
|
-
|
21
|
-
opts.each do |k,v|
|
22
|
-
@contact.locate("name")[0][k] = v.to_s
|
23
|
-
end
|
24
|
-
|
25
30
|
end
|
26
31
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
opts.each do |k,v|
|
32
|
-
@contact.email[k] = v.to_s
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_phone(phone, opts={})
|
37
|
-
@contact << (Ox::Element.new('phone') << phone)
|
38
|
-
opts = whitelabel_opts(opts, :phone)
|
39
|
-
|
40
|
-
opts.each do |k,v|
|
41
|
-
@contact.phone[k] = v.to_s
|
42
|
-
end
|
32
|
+
def add_phone(phone, params={})
|
33
|
+
params.merge!({valid_values: VALID_VALUES, valid_parameters: VALID_PARAMETERS})
|
34
|
+
AdfBuilder::Builder.update_node(@contact, :phone, phone, params)
|
43
35
|
end
|
44
36
|
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
def add_email(email, params={})
|
38
|
+
params.merge!({valid_values: VALID_VALUES, valid_parameters: VALID_PARAMETERS})
|
39
|
+
AdfBuilder::Builder.update_node(@contact, :email, email, params)
|
48
40
|
end
|
49
41
|
end
|
50
42
|
end
|
data/lib/adf_builder/version.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.0.
|
4
|
+
version: 0.0.8
|
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-
|
11
|
+
date: 2021-08-12 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/provider/provider.rb
|
52
53
|
- lib/adf_builder/shared/contact.rb
|
53
54
|
- lib/adf_builder/shared/id.rb
|
54
55
|
- lib/adf_builder/vehicles/colorcombinations.rb
|