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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b6bc8d28e9e614d0e592527719a19c36f80aed6
4
- data.tar.gz: ae285530bf3d1beab9b092645a645c858c7e2c1b
3
+ metadata.gz: 62145702d8eaf8720862e4ebd8f05d5c5af9e9f0
4
+ data.tar.gz: e5bbd03554809fea9e11b2e08506b3ae426dc989
5
5
  SHA512:
6
- metadata.gz: aa6c9a4d8c78fab9c1a605fc0d03a82bae480832f302045adb381a0d3152823d7b4ee5336ae2372a8826b09aa194c1011e06927305405fa572a69cd6e9615114
7
- data.tar.gz: 4d9df7246386e2e7a252e4370f93d3d8ef2fabfd6ab4e4f100d047153cd1c720ed50fa3332ec3e73b1586d592ad1fd1c3cecb9ac8db5ccf04a04b62ed062f59b
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
  [![CI Status](http://img.shields.io/travis/foscomputerservices/dmtd_vbmapp_data.svg?style=flat)](https://travis-ci.org/foscomputerservices/dmtd_vbmapp_data)
4
4
  [![Version](https://img.shields.io/gem/v/dmtd_vbmapp_data.svg?style=flat)](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
5
- [![License](https://img.shields.io/gem/l/dmtd_vbmapp_data.svg?style=flat)](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
6
- [![Platform](https://img.shields.io/gem/p/dmtd_vbmapp_data.svg?style=flat)](http://www.rubydoc.info/github/foscomputerservices/dmtd_vbmapp_data/master)
5
+ [![License](https://img.shields.io/github/license/foscomputerservices/dmtd_vbmapp_data.svg?style=flat)](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 @id.nil?
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, 1)
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
@@ -1,3 +1,3 @@
1
1
  module DmtdVbmappData
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -24,7 +24,8 @@ module DmtdVbmappData
24
24
  @config = {
25
25
  server_url: 'http://data-sandbox.vbmappapp.com',
26
26
  auth_token: '',
27
- organization_id: nil
27
+ organization_id: nil,
28
+ document_type: 'html'
28
29
  }
29
30
 
30
31
  @valid_config_keys = @config.keys
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.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-30 00:00:00.000000000 Z
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