action_network_rest 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e65f3bb81f2d96f6387f07f7eb28ac79cc851c5552ef2f8c8925bec3ae44c192
4
- data.tar.gz: a49f69fe3f7c43e5f7eb5102529943a4dca20c1a69b22baa8c916829a4b85c78
3
+ metadata.gz: 5355878d931e7c6fbf1bcd5ada430683620394bff41a99dde769ce322d5c30cf
4
+ data.tar.gz: 547f1c655027bf85fb67d80d4c4c6e8f14ca2627e356b26e96bff757cca5b675
5
5
  SHA512:
6
- metadata.gz: 2562c647add336113f29e9ab423484c46db0a4e678d7b665d7b556229aa206af28cb652eedde6278b3f4b6cebd908fe17b3af3c41673cba8c3c3cfd6d120980b
7
- data.tar.gz: f1c8324c8cbe351074c43c7c8ea0de6e30de049c73abe3afbecd9b77b8b2865b684a11d7232e0a8f9f10c8df4d2cc6cbcd2712b8a2a8ad2061a9340d5aeb76e7
6
+ metadata.gz: '049b936cbf19c3524a64a88bc8aa15a503f1df73f78d8b461592e270f6d35d8e93ece44344ac24bfb0ebbe53af48c287e64c0a9b6202f2964d28fef88df06cda'
7
+ data.tar.gz: ca67c091023c3b106154fbce86967320ed96c6abed28e52f03ca21357bfdb923792f757d0420082dc35583cd1bf753247c24792798fa19c1d5e0deeec39ff175
data/README.md CHANGED
@@ -60,6 +60,11 @@ person = client.people.find_by_email(person_email)
60
60
  person_id = person.action_network_id
61
61
  puts person.email_addresses
62
62
 
63
+ # Retrieve a Person's data by their phone_number
64
+ person = client.people.find_by_phone_number('+12223334444')
65
+ person_id = person.action_network_id
66
+ puts person.phone_numbers
67
+
63
68
  # Update a Person
64
69
  client.people.update(person_id, {custom_fields: {custom_id: "12345"}})
65
70
 
@@ -26,12 +26,12 @@ Gem::Specification.new do |spec|
26
26
  spec.add_runtime_dependency 'vertebrae', '>= 1.0.0'
27
27
 
28
28
  spec.add_development_dependency 'bundler', '~> 2.1'
29
- spec.add_development_dependency 'debug'
29
+ spec.add_development_dependency 'debug', '> 0'
30
30
  spec.add_development_dependency 'dotenv', '~> 2.7'
31
31
  spec.add_development_dependency 'rake', '~> 13.0'
32
32
  spec.add_development_dependency 'rspec', '~> 3.0'
33
- spec.add_development_dependency 'rubocop'
34
- spec.add_development_dependency 'rubocop-performance'
33
+ spec.add_development_dependency 'rubocop', '> 0'
34
+ spec.add_development_dependency 'rubocop-performance', '> 0'
35
35
  spec.add_development_dependency 'webmock', '~> 3.8.3'
36
36
  spec.metadata['rubygems_mfa_required'] = 'true'
37
37
  end
data/bin/rake CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
15
15
  bundle_binstub = File.expand_path('bundle', __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
18
+ if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
data/bin/rspec CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
15
15
  bundle_binstub = File.expand_path('bundle', __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
18
+ if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
@@ -39,6 +39,25 @@ module ActionNetworkRest
39
39
  set_action_network_id_on_object(person_object) if person_object.present?
40
40
  end
41
41
 
42
+ def find_by_phone_number(phone_number)
43
+ # This works for parsing exactly 1 person's info out of the response.
44
+ # The response we get from Action Network is expected to have
45
+ #
46
+ # "_embedded": {
47
+ # "osdi:people": [{
48
+ # "identifiers": [
49
+ # "action_network:c947bcd0-929e-11e3-a2e9-12313d316c29"
50
+ # ....
51
+ # ]
52
+ # }]
53
+ # }
54
+ #
55
+ url_encoded_filter_string = url_escape("phone_number eq '#{phone_number}'")
56
+ response = client.get_request "#{base_path}?filter=#{url_encoded_filter_string}"
57
+ person_object = response.body[:_embedded][osdi_key].first
58
+ set_action_network_id_on_object(person_object) if person_object.present?
59
+ end
60
+
42
61
  def update(id, person_data)
43
62
  people_path = "#{base_path}#{url_escape(id)}"
44
63
  response = client.put_request people_path, person_data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionNetworkRest
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_network_rest
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
  - Grey Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-10 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vertebrae
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -98,28 +98,28 @@ dependencies:
98
98
  name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ">"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - ">"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop-performance
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - ">"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - ">"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency