usps-imis-api 0.1.0 → 0.1.1.pre.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
  SHA256:
3
- metadata.gz: af49f754c17bf49128b5e71d515f75066ab62cd56573a846b3fb50fa951324ef
4
- data.tar.gz: b0df9cc67032d9d40a474fe119deb0c70d0374358425ef6817d91398698cfd92
3
+ metadata.gz: '08027e766487131b78bbcadf758433dbe21c68869025985259984193a1af610a'
4
+ data.tar.gz: f48eaea5f8950e7bae8f6c30894a789bc21c08dad91168f0e0080c2bc999a7e4
5
5
  SHA512:
6
- metadata.gz: 8a26ceb0adc52557754fce7207a32f5e26eeb445c98f328d04d99dfb8c478daa47a124f5cae59d22661c302d33242ad67883d7fc0e4ae77ee77ee55dc5473177
7
- data.tar.gz: da23f2bd903cf74d4b74e4d2b4324557662366e37cdb5acc299dc208231e64ed4c8f477649b2e2a53db2db03b9d51b4fa692507b49abfce5ea18f1156c7ca436
6
+ metadata.gz: 2ceb21e580ac6a7456ea0f84c0c1f7ba9459b009c6027df48345a07cab5b125db4dd4079115ffc884ff163d26e498f4390afb75ad0e26e12806d94787c63a1bb
7
+ data.tar.gz: 58ef8bf145912588af1fa8786254fad9775e133a742329a490b9e6197d54ecd53c73ef0c8f029601f563c2218b69213b645e171f325a9e09c990ed83afd22231
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  coverage/
2
2
  tmp/
3
3
  .env
4
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-imis-api (0.1.0)
4
+ usps-imis-api (0.1.1.pre.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Readme.md ADDED
@@ -0,0 +1,160 @@
1
+ # USPS iMIS API for Ruby
2
+
3
+ ![Gem Version](https://img.shields.io/gem/v/usps-imis-api)
4
+
5
+ ## Installation
6
+
7
+ Run this command:
8
+
9
+ ```ruby
10
+ gem install usps-imis-api
11
+ ```
12
+
13
+ or add this line to your Gemfile:
14
+
15
+ ```ruby
16
+ gem 'usps-imis-api', '>= 0.1.0'
17
+ ```
18
+
19
+ ## Setup
20
+
21
+ Include the library, and set the configuration:
22
+
23
+ ```ruby
24
+ require 'dotenv/load' # Optionally load environment variables from `.env` file
25
+ require 'usps_imis_api'
26
+
27
+ Imis.configure do |config|
28
+ config.environment = :development # Rails.env
29
+ config.imis_id_query_name = ENV['IMIS_ID_QUERY_NAME']
30
+
31
+ config.username = ENV['IMIS_USERNAME']
32
+ config.password = ENV['IMIS_PASSWORD']
33
+ end
34
+ ```
35
+
36
+ Instantiate the API object:
37
+
38
+ ```ruby
39
+ api = Imis::Api.new
40
+ ```
41
+
42
+ ### Authentication
43
+
44
+ If a token is not available, this will automatically fetch one when needed. As long as that token
45
+ should still be valid, it will reuse the same token. If the token should expire, this will
46
+ automatically request a new token.
47
+
48
+ ## Usage
49
+
50
+ ### iMIS ID
51
+
52
+ To act on member data, you need to have the iMIS ID. If you already have access to that from the
53
+ database, you can skip this step.
54
+
55
+ To convert a member's certificate number into their iMIS ID, run the following method:
56
+
57
+ ```ruby
58
+ api.get_imis_id(certificate)
59
+ ```
60
+
61
+ This will both return the ID, and store it for use with other requests. If you need to change which
62
+ member you are working with, just run this method again with the new certificate number.
63
+
64
+ ### General API Requests
65
+
66
+ #### GET
67
+
68
+ To fetch member data, run e.g.:
69
+
70
+ ```ruby
71
+ api.imis_id = 31092
72
+
73
+ data = api.get('ABC_ASC_Individual_Demog')
74
+ ```
75
+
76
+ #### PUT
77
+
78
+ To update member data, run e.g.:
79
+
80
+ ```ruby
81
+ api.imis_id = 31092
82
+
83
+ data = { 'MMS_Updated' => Time.now.strftime('%Y-%m-%dT%H:%M:%S'), 'TotMMS' => new_total }
84
+ update = api.put_object_fields('ABC_ASC_Individual_Demog', data)
85
+ ```
86
+
87
+ This method fetches the current data structure, and filters it down to just what you want to
88
+ update, to reduce the likelihood of update collisions or type validation failures.
89
+
90
+ ### Public Methods
91
+
92
+ Convert a member's certificate number into an iMIS ID number
93
+
94
+ ```ruby
95
+ api.get_imis_id(certificate)
96
+ ```
97
+
98
+ Manually set the current ID, if you already have it for a given member
99
+
100
+ ```ruby
101
+ api.imis_id = imis_id
102
+ ```
103
+
104
+ GET a business object for the current member
105
+
106
+ ```ruby
107
+ api.get(business_object_name)
108
+ ```
109
+
110
+ Update only specific fields on a business object for the current member
111
+
112
+ `fields` is a hash of shape: `{ field_name => new_value }`
113
+
114
+ ```ruby
115
+ api.put(business_object_name, fields)
116
+ ```
117
+
118
+ Run an IQA Query
119
+
120
+ `query_params` is a hash of shape: `{ param_name => param_value }`
121
+
122
+ ```ruby
123
+ api.query(query_name, query_params)
124
+ ```
125
+
126
+ ### Field Mapper
127
+
128
+ For fields that have already been mapped between the ITCom database and iMIS, you can use the
129
+ Mapper class to further simplify the update interface:
130
+
131
+ ```ruby
132
+ api.mapper.update(:mm, 15)
133
+ ```
134
+
135
+ If there is no known mapping for the requested field, the Mapper will give up, but will provide
136
+ you with the standard API call syntax, and will suggest you inform ITCom leadership of the new
137
+ mapping you need.
138
+
139
+ ## Exception Handling
140
+
141
+ Exception and error response handling will be added later.
142
+
143
+ ## Automated Testing and Linting
144
+
145
+ Testing is available by running:
146
+
147
+ ```ruby
148
+ bundle exec rspec
149
+ ```
150
+
151
+ Linting is available by running:
152
+
153
+ ```ruby
154
+ bundle exec rubocop
155
+ ```
156
+
157
+ ## PHP
158
+
159
+ This same API is
160
+ [available for PHP](https://github.com/unitedstatespowersquadrons/imis-api).
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'usps-imis-api'
5
- s.version = '0.1.0'
5
+ s.version = '0.1.1-1'
6
6
  s.summary = 'iMIS API Wrapper'
7
7
  s.description = 'A wrapper for the iMIS API.'
8
8
  s.homepage = 'http://rubygems.org/gems/usps-imis-api'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-imis-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -22,13 +22,14 @@ files:
22
22
  - ".ruby-version"
23
23
  - Gemfile
24
24
  - Gemfile.lock
25
+ - Readme.md
25
26
  - lib/ext/hash.rb
27
+ - lib/imis.rb
26
28
  - lib/imis/api.rb
27
29
  - lib/imis/config.rb
28
30
  - lib/imis/error/api.rb
29
31
  - lib/imis/error/mapper.rb
30
32
  - lib/imis/mapper.rb
31
- - lib/usps_imis_api.rb
32
33
  - spec/api_spec.rb
33
34
  - spec/mapper_spec.rb
34
35
  - spec/spec_helper.rb
File without changes