action_network_rest 0.6.0 → 0.7.0

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: 0d8ccace61c21488260b04d902f02bf58cea6c834f7d118efec1d4ab1118e25e
4
- data.tar.gz: 13e514a3edb2121263a1cea07ecf67ae809609dbfd596f51d7297e559ef9f48b
3
+ metadata.gz: a6ad7612c6bccf090f5e717750753d3f47314b53b0a36d0b59907102f1dcd1eb
4
+ data.tar.gz: adddc2d4bb8bab60b0db1ebb4312651793e757f193f177c68562c2b96d57cdd2
5
5
  SHA512:
6
- metadata.gz: d48ea50aef6bdc81d44e79e396c7386ca87042af2991ab016205b56e3491868e95ed213f3ed744ddbef3ad5846a72bd2dbd0cd0f80d22195bcdb6b4ba2085300
7
- data.tar.gz: c83e23dbbd65671efc3c9498a1f26406f66156b834f643ae801221b83eefb8220c9e4b0fc9d949db834f7ee8189f52896b736457096045dd20c4ac1a5c809cfc
6
+ metadata.gz: f9e77003bda8400d416e299575383eb36c4d9aa43e8451abb29877e7fd329d5fad8dd58655137218525d351ae49e6b274e75f80e75db90a94161f4ac9eeb9f43
7
+ data.tar.gz: 171aa0166b8a8667f9ee1540ca5bdf3182401a9a7c91badd0bb701815d17e4f0ae22435da8e9202d636a25d7f9a3dd607272f13519238d0110cc4944e0f66021
data/.gitignore CHANGED
@@ -16,20 +16,7 @@
16
16
  # Ignore Byebug command history file.
17
17
  .byebug_history
18
18
 
19
- ## Specific to RubyMotion:
20
- .dat*
21
- .repl_history
22
- build/
23
- *.bridgesupport
24
- build-iPhoneOS/
25
- build-iPhoneSimulator/
26
-
27
- ## Specific to RubyMotion (use of CocoaPods):
28
- #
29
- # We recommend against adding the Pods directory to your .gitignore. However
30
- # you should judge for yourself, the pros and cons are mentioned at:
31
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
- #
19
+
33
20
  # vendor/Pods/
34
21
 
35
22
  ## Documentation cache and generated files:
@@ -56,3 +43,6 @@ Gemfile.lock
56
43
  # .rubocop-https?--*
57
44
 
58
45
  .rspec_status
46
+ .DS_store
47
+ .idea/
48
+ .rakeTasks
data/.rubocop.yml CHANGED
@@ -1,27 +1,14 @@
1
+ require:
2
+ - rubocop-performance
3
+
1
4
  AllCops:
2
- DisabledByDefault: true
3
5
  NewCops: enable
4
-
5
- Security:
6
- Enabled: true
7
-
8
- Bundler/DuplicatedGem:
9
- Enabled: true
10
- Bundler/InsecureProtocolSource:
11
- Enabled: true
12
- Layout/IndentationStyle:
13
- Enabled: true
14
- Layout/SpaceInsideRangeLiteral:
15
- Enabled: true
16
- Lint:
17
- Enabled: true
18
- Lint/RaiseException:
19
- Enabled: true
20
- Naming/AsciiIdentifiers:
21
- Enabled: true
22
- Naming/ClassAndModuleCamelCase:
23
- Enabled: true
24
- Naming/ConstantName:
25
- Enabled: true
26
- Naming/FileName:
27
- Enabled: true
6
+ TargetRubyVersion: 2.6
7
+ Metrics/BlockLength:
8
+ Enabled: false
9
+ Naming/AccessorMethodName:
10
+ Enabled: false
11
+ Naming/MemoizedInstanceVariableName:
12
+ Enabled: false
13
+ Style/Documentation:
14
+ Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 2.7.3
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.6
3
+ - 2.7
4
4
  cache: bundler
5
5
  before_install:
6
6
  - gem install bundler
7
7
  script:
8
8
  - bundle exec rspec
9
- - bundle exec rubocop
9
+ - bundle exec rubocop
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in action_network_rest.gemspec
6
8
  gemspec
data/README.md CHANGED
@@ -106,6 +106,14 @@ tagging = client.tags(tag_id).taggings.get(tagging_id)
106
106
 
107
107
  # Delete a Tagging
108
108
  client.tags(tag_id).taggings.delete(tagging_id)
109
+
110
+ # List Events in an Event Campaign
111
+ event_campaign_id = '123e4567-e89b-12d3-a456-426614174000'
112
+ client.event_campaigns(event_campaign_id).events.list
113
+
114
+ # Add an Attendance
115
+ event_id = '123e4567-e89b-12d3-a456-426655440000'
116
+ client.events(event_id).attendances.create({ person: {email_addresses: [{address: 'alice@example.com'}]}})
109
117
  ```
110
118
 
111
119
  ## Development
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,32 +1,36 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "action_network_rest/version"
5
+ require 'action_network_rest/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "action_network_rest"
8
+ spec.name = 'action_network_rest'
8
9
  spec.version = ActionNetworkRest::VERSION
9
- spec.authors = ["Grey Moore"]
10
- spec.email = ["grey@controlshiftlabs.com"]
10
+ spec.authors = ['Grey Moore']
11
+ spec.email = ['grey@controlshiftlabs.com']
11
12
 
12
- spec.summary = "Ruby client for interacting with the ActionNetwork REST API"
13
- spec.homepage = "https://github.com/controlshift/action-network-rest"
14
- spec.license = "MIT"
13
+ spec.summary = 'Ruby client for interacting with the ActionNetwork REST API'
14
+ spec.homepage = 'https://github.com/controlshift/action-network-rest'
15
+ spec.license = 'MIT'
15
16
 
16
17
  # Specify which files should be added to the gem when it is released.
17
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
21
  end
21
- spec.require_paths = ["lib"]
22
+ spec.require_paths = ['lib']
22
23
 
23
- spec.add_runtime_dependency "vertebrae", "~> 0.6.0"
24
+ spec.required_ruby_version = '>= 2.6'
24
25
 
25
- spec.add_development_dependency "bundler", "~> 2.1"
26
- spec.add_development_dependency "byebug", "~> 11.1"
27
- spec.add_development_dependency "dotenv", "~> 2.7"
28
- spec.add_development_dependency "rake", "~> 13.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
- spec.add_development_dependency 'webmock', '~> 3.8.3'
26
+ spec.add_runtime_dependency 'vertebrae', '~> 0.6.0'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 2.1'
29
+ spec.add_development_dependency 'byebug', '~> 11.1'
30
+ spec.add_development_dependency 'dotenv', '~> 2.7'
31
+ spec.add_development_dependency 'rake', '~> 13.0'
32
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
33
  spec.add_development_dependency 'rubocop'
34
+ spec.add_development_dependency 'rubocop-performance'
35
+ spec.add_development_dependency 'webmock', '~> 3.8.3'
32
36
  end
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "action_network_rest"
4
+ require 'bundler/setup'
5
+ require 'action_network_rest'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "action_network_rest"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
data/bin/rake CHANGED
@@ -8,14 +8,14 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
14
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
23
23
  end
24
24
  end
25
25
 
26
- require "rubygems"
27
- require "bundler/setup"
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
28
 
29
- load Gem.bin_path("rake", "rake")
29
+ load Gem.bin_path('rake', 'rake')
data/bin/rspec CHANGED
@@ -8,14 +8,14 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
14
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
23
23
  end
24
24
  end
25
25
 
26
- require "rubygems"
27
- require "bundler/setup"
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
28
 
29
- load Gem.bin_path("rspec-core", "rspec")
29
+ load Gem.bin_path('rspec-core', 'rspec')
data/example.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/action_network_rest'
2
4
  require 'dotenv'
3
5
  require 'byebug'
@@ -10,4 +12,4 @@ client = ActionNetworkRest.new(api_key: ENV['API_KEY']) # rubocop:disable Lint/U
10
12
  puts "Ready to call Action Network API using 'client' object"
11
13
  byebug # rubocop:disable Lint/Debugger
12
14
 
13
- puts "Bye!"
15
+ puts 'Bye!'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'vertebrae'
2
4
 
3
5
  module ActionNetworkRest
@@ -10,11 +12,14 @@ module ActionNetworkRest
10
12
  end
11
13
  end
12
14
 
13
- require "action_network_rest/version"
14
- require "action_network_rest/client"
15
+ require 'action_network_rest/version'
16
+ require 'action_network_rest/client'
15
17
  require 'action_network_rest/base'
16
18
 
19
+ require 'action_network_rest/attendances'
17
20
  require 'action_network_rest/entry_point'
21
+ require 'action_network_rest/events'
22
+ require 'action_network_rest/event_campaigns'
18
23
  require 'action_network_rest/people'
19
24
  require 'action_network_rest/petitions'
20
25
  require 'action_network_rest/signatures'
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionNetworkRest
4
+ class Attendances < Base
5
+ attr_accessor :event_campaign_id, :event_id
6
+
7
+ def base_path
8
+ if event_campaign_id.present?
9
+ "event_campaigns/#{url_escape(event_campaign_id)}/events/#{url_escape(event_id)}/attendances/"
10
+ else
11
+ "events/#{url_escape(event_id)}/attendances/"
12
+ end
13
+ end
14
+
15
+ def create(attendance_data)
16
+ response = client.post_request base_path, attendance_data
17
+ object_from_response(response)
18
+ end
19
+
20
+ def update(id, attendance_data)
21
+ response = client.put_request "#{base_path}#{url_escape(id)}", attendance_data
22
+ object_from_response(response)
23
+ end
24
+
25
+ private
26
+
27
+ def osdi_key
28
+ 'osdi:attendance'
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class Base < Vertebrae::Model
3
5
  def get(id)
@@ -6,7 +8,7 @@ module ActionNetworkRest
6
8
  end
7
9
 
8
10
  def list(page: 1)
9
- response = client.get_request "#{base_path}?page=#{page}"
11
+ response = client.get_request "#{base_path}?page=#{url_escape(page)}"
10
12
  objects = response.body.dig('_embedded', osdi_key)
11
13
  return [] if objects.nil?
12
14
 
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class Client < Vertebrae::API
3
5
  attr_accessor :api_key
4
6
 
5
- def initialize(options={}, &block)
7
+ def initialize(options = {}, &block)
6
8
  self.api_key = options[:api_key]
7
9
  super(options, &block)
8
10
  end
@@ -12,7 +14,7 @@ module ActionNetworkRest
12
14
  host: 'actionnetwork.org',
13
15
  prefix: '/api/v2',
14
16
  content_type: 'application/json',
15
- additional_headers: {'OSDI-API-Token' => api_key},
17
+ additional_headers: { 'OSDI-API-Token' => api_key },
16
18
  user_agent: 'ruby: ActionNetworkRest'
17
19
  }
18
20
  end
@@ -23,6 +25,26 @@ module ActionNetworkRest
23
25
 
24
26
  ## Helpers to let users do things like `an_client.people.create(params)`
25
27
 
28
+ def events(event_id = nil)
29
+ if @_events&.send(:[], event_id).nil?
30
+ @_events = {} if @_events.nil?
31
+
32
+ @_events[event_id] = ActionNetworkRest::Events.new(event_id: event_id, client: self)
33
+ end
34
+
35
+ @_events[event_id]
36
+ end
37
+
38
+ def event_campaigns(event_campaign_id = nil)
39
+ if @_event_campaigns&.send(:[], event_campaign_id).nil?
40
+ @_event_campaigns = {} if @_event_campaigns.nil?
41
+
42
+ @_event_campaigns[event_campaign_id] = ActionNetworkRest::EventCampaigns.new(event_campaign_id, client: self)
43
+ end
44
+
45
+ @_event_campaigns[event_campaign_id]
46
+ end
47
+
26
48
  def entry_point
27
49
  @_entry_point ||= ActionNetworkRest::EntryPoint.new(client: self)
28
50
  end
@@ -31,7 +53,7 @@ module ActionNetworkRest
31
53
  @_people ||= ActionNetworkRest::People.new(client: self)
32
54
  end
33
55
 
34
- def petitions(petition_id=nil)
56
+ def petitions(petition_id = nil)
35
57
  if @_petitions&.send(:[], petition_id).nil?
36
58
  @_petitions = {} if @_petitions.nil?
37
59
 
@@ -41,7 +63,7 @@ module ActionNetworkRest
41
63
  @_petitions[petition_id]
42
64
  end
43
65
 
44
- def tags(tag_id=nil)
66
+ def tags(tag_id = nil)
45
67
  if @_tags&.send(:[], tag_id).nil?
46
68
  @_tags = {} if @_tags.nil?
47
69
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class EntryPoint < Vertebrae::Model
3
5
  def base_path
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionNetworkRest
4
+ class EventCampaigns < Base
5
+ attr_accessor :event_campaign_id
6
+
7
+ # Without a event_campaign_id, this class is used for EventCampaign creation/update endpoints.
8
+ # With a event_campaign_id, this class is used to initialise the Events class,
9
+ # like client.event_campaigns(123).events
10
+ def initialize(event_campaign_id = nil, client:)
11
+ super(client: client, event_campaign_id: event_campaign_id)
12
+ end
13
+
14
+ def base_path
15
+ 'event_campaigns/'
16
+ end
17
+
18
+ def create(event_campaign_data)
19
+ response = client.post_request(base_path, event_campaign_data)
20
+ object_from_response(response)
21
+ end
22
+
23
+ def events(event_id = nil)
24
+ @_events ||= ActionNetworkRest::Events.new(event_campaign_id: event_campaign_id, event_id: event_id,
25
+ client: client)
26
+ end
27
+
28
+ private
29
+
30
+ def osdi_key
31
+ 'action_network:event_campaigns'
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionNetworkRest
4
+ class Events < Base
5
+ attr_accessor :event_campaign_id, :event_id
6
+
7
+ def initialize(client:, event_campaign_id: nil, event_id: nil)
8
+ super(client: client, event_id: event_id, event_campaign_id: event_campaign_id)
9
+ end
10
+
11
+ def base_path
12
+ if event_campaign_id.present?
13
+ "event_campaigns/#{url_escape(event_campaign_id)}/events/"
14
+ else
15
+ 'events/'
16
+ end
17
+ end
18
+
19
+ def create(event_data)
20
+ response = client.post_request(base_path, event_data)
21
+ object_from_response(response)
22
+ end
23
+
24
+ def attendances
25
+ @_attendances ||= ActionNetworkRest::Attendances.new(client: client, event_id: event_id,
26
+ event_campaign_id: event_campaign_id)
27
+ end
28
+
29
+ private
30
+
31
+ def osdi_key
32
+ 'osdi:events'
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class People < Base
3
5
  def base_path
@@ -5,17 +7,15 @@ module ActionNetworkRest
5
7
  end
6
8
 
7
9
  def create(person_data, tags: [])
8
- post_body = {'person' => person_data}
9
- if tags.any?
10
- post_body['add_tags'] = tags
11
- end
10
+ post_body = { 'person' => person_data }
11
+ post_body['add_tags'] = tags if tags.any?
12
12
 
13
13
  response = client.post_request base_path, post_body
14
14
  object_from_response(response)
15
15
  end
16
16
 
17
17
  def unsubscribe(id)
18
- request_body = {email_addresses: [{status: 'unsubscribed'}]}
18
+ request_body = { email_addresses: [{ status: 'unsubscribed' }] }
19
19
  response = client.put_request "#{base_path}#{url_escape(id)}", request_body
20
20
  object_from_response(response)
21
21
  end
@@ -36,9 +36,7 @@ module ActionNetworkRest
36
36
  url_encoded_filter_string = url_escape("email_address eq '#{email}'")
37
37
  response = client.get_request "#{base_path}?filter=#{url_encoded_filter_string}"
38
38
  person_object = response.body[:_embedded][osdi_key].first
39
- if person_object.present?
40
- set_action_network_id_on_object(person_object)
41
- end
39
+ set_action_network_id_on_object(person_object) if person_object.present?
42
40
  end
43
41
 
44
42
  def update(id, person_data)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class Petitions < Base
3
5
  attr_accessor :petition_id
@@ -5,7 +7,7 @@ module ActionNetworkRest
5
7
  # Without a petition_id, this class is used for Petition creation/update endpoints.
6
8
  # With a petition_id, this class is used to initialise the Signatures class,
7
9
  # like client.petitions(123).signatures
8
- def initialize(petition_id=nil, client:)
10
+ def initialize(petition_id = nil, client:)
9
11
  super(client: client, petition_id: petition_id)
10
12
  end
11
13
 
@@ -21,7 +23,7 @@ module ActionNetworkRest
21
23
  post_body = petition_data
22
24
  if creator_person_id.present?
23
25
  creator_person_url = action_network_url("/people/#{url_escape(creator_person_id)}")
24
- post_body['_links'] = {'osdi:creator' => {href: creator_person_url}}
26
+ post_body['_links'] = { 'osdi:creator' => { href: creator_person_url } }
25
27
  end
26
28
 
27
29
  response = client.post_request base_path, post_body
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class Signatures < Base
3
5
  attr_accessor :petition_id
@@ -8,16 +10,14 @@ module ActionNetworkRest
8
10
 
9
11
  def create(signature_data, tags: [])
10
12
  post_body = signature_data
11
- if tags.any?
12
- post_body['add_tags'] = tags
13
- end
13
+ post_body['add_tags'] = tags if tags.any?
14
14
 
15
- response = client.post_request base_path, post_body
15
+ response = client.post_request(base_path, post_body)
16
16
  object_from_response(response)
17
17
  end
18
18
 
19
19
  def update(id, signature_data)
20
- response = client.put_request "#{base_path}#{url_escape(id)}", signature_data
20
+ response = client.put_request("#{base_path}#{url_escape(id)}", signature_data)
21
21
  object_from_response(response)
22
22
  end
23
23
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class Taggings < Base
3
5
  attr_accessor :tag_id
@@ -9,7 +11,7 @@ module ActionNetworkRest
9
11
  def create(tagging_data, person_id:)
10
12
  post_body = tagging_data
11
13
  person_url = action_network_url("/people/#{url_escape(person_id)}")
12
- post_body['_links'] = {'osdi:person' => {href: person_url}}
14
+ post_body['_links'] = { 'osdi:person' => { href: person_url } }
13
15
 
14
16
  response = client.post_request base_path, post_body
15
17
  object_from_response(response)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
4
  class Tags < Base
3
5
  attr_accessor :tag_id
@@ -5,7 +7,7 @@ module ActionNetworkRest
5
7
  # Without a tag_id, this class is used for the Tag creation endpoint.
6
8
  # With a tag_id, this class is used to initialise the Taggings class,
7
9
  # like client.tags(123).taggings
8
- def initialize(tag_id=nil, client:)
10
+ def initialize(tag_id = nil, client:)
9
11
  super(client: client, tag_id: tag_id)
10
12
  end
11
13
 
@@ -18,7 +20,7 @@ module ActionNetworkRest
18
20
  end
19
21
 
20
22
  def create(name)
21
- post_body = {name: name}
23
+ post_body = { name: name }
22
24
  response = client.post_request base_path, post_body
23
25
  object_from_response(response)
24
26
  end
@@ -29,7 +31,7 @@ module ActionNetworkRest
29
31
  # all tags and iterate to find the one we're looking for.
30
32
  page = 1
31
33
  loop do
32
- tags = self.list(page: page)
34
+ tags = list(page: page)
33
35
  return nil if tags.empty?
34
36
 
35
37
  found_tag = tags.find { |t| t.name == name }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionNetworkRest
2
- VERSION = "0.6.0"
4
+ VERSION = '0.7.0'
3
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: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grey Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vertebrae
@@ -95,21 +95,21 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: webmock
98
+ name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 3.8.3
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
- version: 3.8.3
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rubocop
112
+ name: rubocop-performance
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 3.8.3
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 3.8.3
125
139
  description:
126
140
  email:
127
141
  - grey@controlshiftlabs.com
@@ -146,9 +160,12 @@ files:
146
160
  - bin/rspec
147
161
  - example.rb
148
162
  - lib/action_network_rest.rb
163
+ - lib/action_network_rest/attendances.rb
149
164
  - lib/action_network_rest/base.rb
150
165
  - lib/action_network_rest/client.rb
151
166
  - lib/action_network_rest/entry_point.rb
167
+ - lib/action_network_rest/event_campaigns.rb
168
+ - lib/action_network_rest/events.rb
152
169
  - lib/action_network_rest/people.rb
153
170
  - lib/action_network_rest/petitions.rb
154
171
  - lib/action_network_rest/signatures.rb
@@ -167,14 +184,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
184
  requirements:
168
185
  - - ">="
169
186
  - !ruby/object:Gem::Version
170
- version: '0'
187
+ version: '2.6'
171
188
  required_rubygems_version: !ruby/object:Gem::Requirement
172
189
  requirements:
173
190
  - - ">="
174
191
  - !ruby/object:Gem::Version
175
192
  version: '0'
176
193
  requirements: []
177
- rubygems_version: 3.0.8
194
+ rubygems_version: 3.1.6
178
195
  signing_key:
179
196
  specification_version: 4
180
197
  summary: Ruby client for interacting with the ActionNetwork REST API