mais_person_client 0.0.1 → 0.0.2

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: 21a49caa00804975de1f77ec3900b4da918532ae65938992015b7de7498109c3
4
- data.tar.gz: a622be5a3473237e36b95f59867757b9de485aa171918486e061f812ec3e03d5
3
+ metadata.gz: 6b872fec73c13f1df1ab4cb1fec9cf729502eafb10b5924d0082347e1258b7eb
4
+ data.tar.gz: 9e13fe7906ba9c46ed96fea26434c290349f27b5f7caf4f5c9f8b6035223f12c
5
5
  SHA512:
6
- metadata.gz: 8fd1219a40c4e6eb38f0ccef53946d6f0d97ab88bf9076eab3c6c48138c5978c425076429ee5ad2cba4c1da0175ab1763788b93e1b6cddb1447e0242396d3ba3
7
- data.tar.gz: dad511bb9d5e330152d147e38454994d2951998364938bdb7c0513239837e960f5e9468695b2fbfd52863f2c76d1ba54fd9c669e021d8a8bc9cccd57f9a3cdce
6
+ metadata.gz: 9ab061800050aaa112c0205ce54cbec61f8bdb257a95bb753a0b392ef13c7293c4abe4ac4e03f925e55e3e2f5bf0a8197d63b97ded760e77ea16ac4650262eb2
7
+ data.tar.gz: 788c40c60b666ddcc582a7168f7aa85309b7004db61b253efdcf727f19b1281925665023f37951e73ec1a99bf1490cc812493a746f723b303b2a832cd92a6920
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mais_person_client (0.0.1)
4
+ mais_person_client (0.0.2)
5
5
  activesupport (>= 4.2)
6
6
  faraday
7
7
  faraday-retry
data/README.md CHANGED
@@ -37,10 +37,15 @@ client = MaisPersonClient.configure(
37
37
  base_url: Settings.mais_person.base_url,
38
38
  user_agent: 'some-user-agent-string-to-send-in-requests' # defaults to 'stanford-library'
39
39
  )
40
- client.fetch_user('nataliex') # get a single user by sunet
41
- client.fetch_users # return all users
40
+ result = client.fetch_user('nataliex') # get a single user by sunet, returns an XML doc as a string
41
+
42
+ person = MaisPersonClient::Person.new(result) # returns a class with the XML parsed
43
+ person.sunetid
44
+ => 'donaldduck'
42
45
  ```
43
46
 
47
+
48
+
44
49
  You can also invoke methods directly on the client class, which is useful in a Rails application environment where you might initialize the client in an
45
50
  initializer and then invoke client methods in many other contexts where you want to be sure configuration has already occurred, e.g.:
46
51
 
@@ -77,6 +77,19 @@ class MaisPersonClient
77
77
  names.find { |name| name.type == 'display' }
78
78
  end
79
79
 
80
+ # Name component helpers
81
+ def first_name
82
+ registered_name&.first_name
83
+ end
84
+
85
+ def middle_name
86
+ registered_name&.middle
87
+ end
88
+
89
+ def last_name
90
+ registered_name&.last
91
+ end
92
+
80
93
  # Titles (multiple possible)
81
94
  def titles
82
95
  xml.xpath('//title').map do |title_node|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class MaisPersonClient
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mais_person_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico