dmtd_vbmapp_data 1.0.0 → 1.0.1
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/CHANGELOG.md +7 -0
- data/README.md +6 -2
- data/lib/dmtd_vbmapp_data/client.rb +12 -6
- data/lib/dmtd_vbmapp_data/request_helpers.rb +1 -0
- data/lib/dmtd_vbmapp_data/version.rb +1 -1
- data/lib/dmtd_vbmapp_data.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62145702d8eaf8720862e4ebd8f05d5c5af9e9f0
|
4
|
+
data.tar.gz: e5bbd03554809fea9e11b2e08506b3ae426dc989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea1e65ece5e633fe43f0bd943c8d71d816b058ba691f5c79eb40d74c7a87bb3d07724d17c864b461b848797f3aab1263a3ab8627468122496bd6c14d14679397
|
7
|
+
data.tar.gz: 4fb9cb8b6fadab766af986123a5b4471883077466ffa7f9b1bec236792f27a2f82463bb046d385ef9bcec67ed276212cb98dbc1c13dc1a46311aa6bb0389c04f
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Change log for: dmtd_vbmapp_data
|
2
|
+
|
3
|
+
## 1.0.1
|
4
|
+
|
5
|
+
* Added support for setting the X-DocType via DmtdFoundation.configure document_type: 'text' || 'html'
|
6
|
+
* Fixed a bug in the client_spec. It now specifies the correct organization id.
|
7
|
+
* Changed Client.new() to allow specification of the id or code and then be used throughout the API without needing to pull it from the server.
|
data/README.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/foscomputerservices/dmtd_vbmapp_data)
|
4
4
|
[](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
|
5
|
-
[](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
|
5
|
+
[](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
|
7
6
|
|
8
7
|
The gem is provided to ease access to DMTD's vbmappapp.com REST service.
|
9
8
|
|
@@ -31,8 +30,13 @@ Upon receiving an authorization token from Data Makes the Difference, add the fo
|
|
31
30
|
DmtdVbmappData.configure server_url: 'your_assigned_web_service_url' # It can also be 'http://data-sandbox.vbmappapp.com' for testing purposes
|
32
31
|
DmtdVbmappData.configure auth_token: 'your_auth_token'
|
33
32
|
DmtdVbmappData.configure organization_id: your_organization_id
|
33
|
+
DmtdVbmappData.configure document_type: 'html' # It can be either 'html' or 'text'
|
34
34
|
```
|
35
35
|
|
36
|
+
## Further Reading
|
37
|
+
|
38
|
+
Full documentation of the gem can be found at: [http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
|
39
|
+
|
36
40
|
## Contributing
|
37
41
|
|
38
42
|
1. Fork it ( https://github.com/[my-github-username]/dmtd_vbmapp_data/fork )
|
@@ -29,10 +29,11 @@ module DmtdVbmappData
|
|
29
29
|
# This operation blocks until it receives a response from the VB-MAPP Data Server.
|
30
30
|
#
|
31
31
|
# If +id+ is specified, then the instance will *not* be sent to the server, it is assumed to already be there.
|
32
|
+
# Otherwise it will be sent to the server if is_valid_for_create? is true.
|
32
33
|
#
|
33
34
|
# Params:
|
34
|
-
# +date_of_birth+:: the date of birth of the client as a ruby Date object
|
35
|
-
# +gender+:: the gender of the client, either +GENDER_MALE+ or +GENDER_FEMALE+
|
35
|
+
# +date_of_birth+:: the date of birth of the client as a ruby Date object (may be nil)
|
36
|
+
# +gender+:: the gender of the client, either +GENDER_MALE+ or +GENDER_FEMALE+ (may be nil)
|
36
37
|
# +id+:: the vbmapp_data server's identifier for this client (may be nil)
|
37
38
|
# +organization_id+:: the organization identifier (may be nil, if so DmtdVbmappData.config['organization_id'] will be used)
|
38
39
|
# +code+:: a code that can be used to refer to the client; possibly a key in the customer's database (may be nil)
|
@@ -40,8 +41,8 @@ module DmtdVbmappData
|
|
40
41
|
# +last_name+:: the last name of the client (may be nil)
|
41
42
|
# +settings+:: a string value that can be associated with the client (may be nil)
|
42
43
|
def initialize(opts)
|
43
|
-
@date_of_birth = opts.fetch(:date_of_birth)
|
44
|
-
@gender = opts.fetch(:gender)
|
44
|
+
@date_of_birth = opts.fetch(:date_of_birth, nil)
|
45
|
+
@gender = opts.fetch(:gender, nil)
|
45
46
|
@id = opts.fetch(:id, nil)
|
46
47
|
@organization_id = opts.fetch(:organization_id, DmtdVbmappData.config[:organization_id])
|
47
48
|
@code = opts.fetch(:code, nil)
|
@@ -54,7 +55,7 @@ module DmtdVbmappData
|
|
54
55
|
@created_at = opts.fetch(:created_at, date)
|
55
56
|
@updated_at = opts.fetch(:updated_at, date)
|
56
57
|
|
57
|
-
create_server_client if
|
58
|
+
create_server_client if is_valid_for_create?
|
58
59
|
end
|
59
60
|
|
60
61
|
# Retrieves all existing clients from the VB-MAPP Data Server
|
@@ -77,6 +78,11 @@ module DmtdVbmappData
|
|
77
78
|
Vbmapp.new(client: self)
|
78
79
|
end
|
79
80
|
|
81
|
+
# Returns true if the receiver is parametrized correctly for creation on the server
|
82
|
+
def is_valid_for_create?
|
83
|
+
@id.nil? && !@date_of_birth.nil? && !@gender.nil? && !@organization_id.nil?
|
84
|
+
end
|
85
|
+
|
80
86
|
private
|
81
87
|
|
82
88
|
def self.end_point
|
@@ -101,7 +107,7 @@ module DmtdVbmappData
|
|
101
107
|
result = nil
|
102
108
|
id = opts.fetch(:id, nil)
|
103
109
|
code = opts.fetch(:code, nil)
|
104
|
-
organization_id = opts.fetch(:organization_id,
|
110
|
+
organization_id = opts.fetch(:organization_id, 3)
|
105
111
|
|
106
112
|
params = { organization_id: organization_id }
|
107
113
|
|
@@ -85,6 +85,7 @@ module DmtdVbmappData
|
|
85
85
|
request['Content-Type'] = 'application/json'
|
86
86
|
request['X-ClientId'] = client_id unless client_id.nil?
|
87
87
|
request['X-ClientCode'] = client_code unless client_code.nil?
|
88
|
+
request['X-DocType'] = DmtdVbmappData.config[:document_type].downcase unless DmtdVbmappData.config[:document_type].nil?
|
88
89
|
end
|
89
90
|
end
|
90
91
|
end
|
data/lib/dmtd_vbmapp_data.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dmtd_vbmapp_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Hunt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: psych
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- ".gitignore"
|
106
106
|
- ".rspec"
|
107
107
|
- ".travis.yml"
|
108
|
+
- CHANGELOG.md
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE.txt
|
110
111
|
- README.md
|