action_kit_rest 0.4.3 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +24 -0
  3. data/.rubocop.yml +26 -0
  4. data/.ruby-version +1 -1
  5. data/Gemfile +11 -9
  6. data/README.md +2 -2
  7. data/Rakefile +15 -18
  8. data/action_kit_rest.gemspec +28 -34
  9. data/lib/action_kit_rest/action.rb +3 -1
  10. data/lib/action_kit_rest/actions/event_create_action.rb +5 -3
  11. data/lib/action_kit_rest/actions/event_signup_action.rb +6 -3
  12. data/lib/action_kit_rest/actions/unsubscribe_action.rb +3 -1
  13. data/lib/action_kit_rest/allowed_user_field.rb +3 -1
  14. data/lib/action_kit_rest/api.rb +9 -7
  15. data/lib/action_kit_rest/base.rb +5 -4
  16. data/lib/action_kit_rest/client.rb +5 -3
  17. data/lib/action_kit_rest/event.rb +3 -1
  18. data/lib/action_kit_rest/event_signup.rb +3 -1
  19. data/lib/action_kit_rest/language.rb +3 -1
  20. data/lib/action_kit_rest/list.rb +3 -1
  21. data/lib/action_kit_rest/page.rb +4 -2
  22. data/lib/action_kit_rest/pages/base.rb +4 -5
  23. data/lib/action_kit_rest/pages/donation_page.rb +3 -1
  24. data/lib/action_kit_rest/pages/event_campaign_page.rb +4 -2
  25. data/lib/action_kit_rest/pages/import_page.rb +3 -1
  26. data/lib/action_kit_rest/pages/signup_page.rb +3 -1
  27. data/lib/action_kit_rest/pages/unsubscribe_page.rb +3 -1
  28. data/lib/action_kit_rest/phone.rb +2 -0
  29. data/lib/action_kit_rest/railties.rb +3 -1
  30. data/lib/action_kit_rest/response/collection.rb +4 -4
  31. data/lib/action_kit_rest/response/raise_error.rb +15 -12
  32. data/lib/action_kit_rest/response/validation_error.rb +20 -9
  33. data/lib/action_kit_rest/response/wrapper.rb +10 -10
  34. data/lib/action_kit_rest/tag.rb +6 -6
  35. data/lib/action_kit_rest/user.rb +3 -1
  36. data/lib/action_kit_rest/version.rb +3 -1
  37. data/lib/action_kit_rest.rb +2 -0
  38. data/spec/lib/action_kit_rest/actions/event_create_action_spec.rb +6 -4
  39. data/spec/lib/action_kit_rest/actions/event_signup_action_spec.rb +6 -4
  40. data/spec/lib/action_kit_rest/allowed_user_field_spec.rb +9 -7
  41. data/spec/lib/action_kit_rest/api_spec.rb +95 -0
  42. data/spec/lib/action_kit_rest/logger_spec.rb +7 -5
  43. data/spec/lib/action_kit_rest/page_spec.rb +28 -28
  44. data/spec/lib/action_kit_rest/pages/event_campaign_page_spec.rb +25 -20
  45. data/spec/lib/action_kit_rest/pages/import_page_spec.rb +21 -17
  46. data/spec/lib/action_kit_rest/response/collection_spec.rb +13 -11
  47. data/spec/lib/action_kit_rest/response/validation_error_spec.rb +16 -4
  48. data/spec/lib/action_kit_rest/response/wrapper_spec.rb +6 -4
  49. data/spec/lib/action_kit_rest/user_spec.rb +11 -9
  50. data/spec/spec_helper.rb +6 -4
  51. data/spec/support/shared_contexts/stub_logger.rb +4 -2
  52. metadata +61 -57
  53. data/.travis.yml +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9e054d6149504eb67b5396a47652ef4a967492d3272bc00223fdafbb8abe7c9
4
- data.tar.gz: 6dc40c7e2a42e04ca3c908e7dc1962695747fbc19a39e7e289138725a399f3ee
3
+ metadata.gz: 1817fcc57f6d22b7c399e0face9405049f77417e6ea2b27c9e32218be76af124
4
+ data.tar.gz: 0eb382953e3c3c691191ce9f9c0ff61f5d39cefac40e77921ba2bc4d5366068f
5
5
  SHA512:
6
- metadata.gz: 9b214c2182a621872747067d02c7f2d317dc9cb376e14e1c5dd9d3d90be31a170d2c52305719078233c1b486695cd2ad1372067f641de8ec389d0eb574814403
7
- data.tar.gz: b97e261b7a52b32982feb5976a67e7d9dd155832e964dd1161e7ece6db573cef001fea03b7f1c386b7055bd96b2abf5aa8a255e2c97d0bb7bc5f54c85248f09c
6
+ metadata.gz: f07602cc5779ae7eb6c7cfd5bad09ec780443c8b0e702a36264035a92add5b4ca06135196e4ea41aa6dcfa0e2d8ea7effa4777adc57e0842666199989db9bd39
7
+ data.tar.gz: cd5c4e3b3e70f5979cd42981b9c116ef475cf9af06ebd8e8c857b594d7a43f15dc9e12fec86de117adda5b691cc0b52571c461ef46035bee8ab97b09742e76ee
@@ -0,0 +1,24 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v2
9
+ - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - run: bundle install
14
+ - run: bundle exec rspec
15
+ rubocop:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
20
+ with:
21
+ ruby-version: 2.7
22
+ bundler-cache: true
23
+ - run: bundle install
24
+ - run: bundle exec rubocop
data/.rubocop.yml ADDED
@@ -0,0 +1,26 @@
1
+ AllCops:
2
+ DisabledByDefault: true
3
+
4
+ Security:
5
+ Enabled: true
6
+
7
+ Bundler/DuplicatedGem:
8
+ Enabled: true
9
+ Bundler/InsecureProtocolSource:
10
+ Enabled: true
11
+ Layout/IndentationStyle:
12
+ Enabled: true
13
+ Layout/SpaceInsideRangeLiteral:
14
+ Enabled: true
15
+ Lint:
16
+ Enabled: true
17
+ Lint/RaiseException:
18
+ Enabled: true
19
+ Naming/AsciiIdentifiers:
20
+ Enabled: true
21
+ Naming/ClassAndModuleCamelCase:
22
+ Enabled: true
23
+ Naming/ConstantName:
24
+ Enabled: true
25
+ Naming/FileName:
26
+ Enabled: true
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.7.4
data/Gemfile CHANGED
@@ -1,15 +1,17 @@
1
- source "http://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- gem 'vertebrae', '~> 0.5.0'
3
+ source 'http://rubygems.org'
4
+
5
+ gem 'vertebrae', '>= 0.6.0'
4
6
 
5
7
  group :development do
6
- gem 'rspec', '~> 3.7'
7
- gem 'webmock', '~> 3.3'
8
- gem 'byebug', '>= 10.0.2', '<11.0'
9
8
  gem 'bundler', '>= 2.0', '<3.0'
10
- gem 'eventmachine', '>=1.2.5', '<2.0'
11
- gem 'em-synchrony', '>=1.0.6', '<2.0'
9
+ gem 'byebug'
12
10
  gem 'em-http-request', '>=1.1.5', '<2.0'
13
- gem 'juwelier', '>=2.4.9', '<3.0'
11
+ gem 'em-synchrony', '>=1.0.6', '<2.0'
12
+ gem 'eventmachine', '>=1.2.5', '<2.0'
13
+ gem 'juwelier', git: 'https://github.com/flajann2/juwelier.git'
14
+ gem 'rspec', '~> 3.7'
15
+ gem 'rubocop'
16
+ gem 'webmock', '~> 3.3'
14
17
  end
15
-
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # action_kit_rest
1
+ # action\_kit\_rest
2
2
 
3
3
  A ruby binding for the ActionKit REST API
4
4
 
5
- [![Build Status](https://travis-ci.org/controlshift/action_kit_rest.svg)](https://travis-ci.org/controlshift/action_kit_rest)
5
+ [![CI Status](https://github.com/controlshift/action_kit_rest/actions/workflows/ci.yml/badge.svg)](https://github.com/controlshift/action_kit_rest/actions/workflows/ci.yml)
6
6
 
7
7
  ## Usage
8
8
 
data/Rakefile CHANGED
@@ -1,47 +1,44 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
5
  begin
6
6
  Bundler.setup(:default, :development)
7
7
  rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
8
+ warn e.message
9
+ warn 'Run `bundle install` to install missing gems'
10
10
  exit e.status_code
11
11
  end
12
12
  require 'rake'
13
- require './lib/action_kit_rest/version.rb'
14
-
13
+ require './lib/action_kit_rest/version'
15
14
 
16
15
  require 'juwelier'
17
16
  Juwelier::Tasks.new do |gem|
18
- # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
19
- gem.name = "action_kit_rest"
17
+ gem.name = 'action_kit_rest'
20
18
  gem.version = ActionKitRest::VERSION::STRING
21
- gem.homepage = "http://github.com/controlshift/action_kit_rest"
22
- gem.license = "MIT"
23
- gem.summary = %Q{A wrapper for the ActionKit REST API}
24
- gem.description = %Q{Gem for interacting with the ActionKit API}
25
- gem.email = "systems@controlshiftlabs.com"
26
- gem.authors = ["Nathan Woodhull", 'Diego Marcet', 'Jacinda Moore']
19
+ gem.homepage = 'http://github.com/controlshift/action_kit_rest'
20
+ gem.license = 'MIT'
21
+ gem.summary = %(A wrapper for the ActionKit REST API)
22
+ gem.description = %(Gem for interacting with the ActionKit API)
23
+ gem.email = 'systems@controlshiftlabs.com'
24
+ gem.authors = ['Nathan Woodhull', 'Diego Marcet', 'Grey Moore']
27
25
  # dependencies defined in Gemfile
28
26
  end
29
27
  Juwelier::RubygemsDotOrgTasks.new
30
28
 
31
-
32
29
  require 'rspec/core/rake_task'
33
30
  desc 'Default: run specs.'
34
- task :default => :spec
31
+ task default: :spec
35
32
 
36
- desc "Run specs"
33
+ desc 'Run specs'
37
34
  RSpec::Core::RakeTask.new do |t|
38
- t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
35
+ t.pattern = './spec/**/*_spec.rb' # don't need this, it's default.
39
36
  t.rspec_opts = '--color'
40
37
  end
41
38
 
42
39
  require 'rdoc/task'
43
40
  Rake::RDocTask.new do |rdoc|
44
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
45
42
 
46
43
  rdoc.rdoc_dir = 'rdoc'
47
44
  rdoc.title = "action_kit_rest #{version}"
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: action_kit_rest 0.4.3 ruby lib
5
+ # stub: action_kit_rest 0.4.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "action_kit_rest".freeze
9
- s.version = "0.4.3"
9
+ s.version = "0.4.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
- s.authors = ["Nathan Woodhull".freeze, "Diego Marcet".freeze, "Jacinda Moore".freeze]
14
- s.date = "2020-04-24"
13
+ s.authors = ["Nathan Woodhull".freeze, "Diego Marcet".freeze, "Grey Moore".freeze]
14
+ s.date = "2021-10-05"
15
15
  s.description = "Gem for interacting with the ActionKit API".freeze
16
16
  s.email = "systems@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -20,10 +20,11 @@ Gem::Specification.new do |s|
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
+ ".github/workflows/ci.yml",
23
24
  ".rspec",
25
+ ".rubocop.yml",
24
26
  ".ruby-gemset",
25
27
  ".ruby-version",
26
- ".travis.yml",
27
28
  "Gemfile",
28
29
  "LICENSE.txt",
29
30
  "README.md",
@@ -76,6 +77,7 @@ Gem::Specification.new do |s|
76
77
  "spec/lib/action_kit_rest/actions/event_create_action_spec.rb",
77
78
  "spec/lib/action_kit_rest/actions/event_signup_action_spec.rb",
78
79
  "spec/lib/action_kit_rest/allowed_user_field_spec.rb",
80
+ "spec/lib/action_kit_rest/api_spec.rb",
79
81
  "spec/lib/action_kit_rest/logger_spec.rb",
80
82
  "spec/lib/action_kit_rest/page_spec.rb",
81
83
  "spec/lib/action_kit_rest/pages/event_campaign_page_spec.rb",
@@ -89,43 +91,35 @@ Gem::Specification.new do |s|
89
91
  ]
90
92
  s.homepage = "http://github.com/controlshift/action_kit_rest".freeze
91
93
  s.licenses = ["MIT".freeze]
92
- s.rubygems_version = "3.0.8".freeze
94
+ s.rubygems_version = "3.1.6".freeze
93
95
  s.summary = "A wrapper for the ActionKit REST API".freeze
94
96
 
95
97
  if s.respond_to? :specification_version then
96
98
  s.specification_version = 4
99
+ end
97
100
 
98
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
99
- s.add_runtime_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
100
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.7"])
101
- s.add_development_dependency(%q<webmock>.freeze, ["~> 3.3"])
102
- s.add_development_dependency(%q<byebug>.freeze, [">= 10.0.2", "< 11.0"])
103
- s.add_development_dependency(%q<bundler>.freeze, [">= 2.0", "< 3.0"])
104
- s.add_development_dependency(%q<eventmachine>.freeze, [">= 1.2.5", "< 2.0"])
105
- s.add_development_dependency(%q<em-synchrony>.freeze, [">= 1.0.6", "< 2.0"])
106
- s.add_development_dependency(%q<em-http-request>.freeze, [">= 1.1.5", "< 2.0"])
107
- s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0"])
108
- else
109
- s.add_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
110
- s.add_dependency(%q<rspec>.freeze, ["~> 3.7"])
111
- s.add_dependency(%q<webmock>.freeze, ["~> 3.3"])
112
- s.add_dependency(%q<byebug>.freeze, [">= 10.0.2", "< 11.0"])
113
- s.add_dependency(%q<bundler>.freeze, [">= 2.0", "< 3.0"])
114
- s.add_dependency(%q<eventmachine>.freeze, [">= 1.2.5", "< 2.0"])
115
- s.add_dependency(%q<em-synchrony>.freeze, [">= 1.0.6", "< 2.0"])
116
- s.add_dependency(%q<em-http-request>.freeze, [">= 1.1.5", "< 2.0"])
117
- s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0"])
118
- end
101
+ if s.respond_to? :add_runtime_dependency then
102
+ s.add_runtime_dependency(%q<vertebrae>.freeze, [">= 0.6.0"])
103
+ s.add_development_dependency(%q<bundler>.freeze, [">= 2.0", "< 3.0"])
104
+ s.add_development_dependency(%q<byebug>.freeze, [">= 0"])
105
+ s.add_development_dependency(%q<em-http-request>.freeze, [">= 1.1.5", "< 2.0"])
106
+ s.add_development_dependency(%q<em-synchrony>.freeze, [">= 1.0.6", "< 2.0"])
107
+ s.add_development_dependency(%q<eventmachine>.freeze, [">= 1.2.5", "< 2.0"])
108
+ s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
109
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.7"])
110
+ s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
111
+ s.add_development_dependency(%q<webmock>.freeze, ["~> 3.3"])
119
112
  else
120
- s.add_dependency(%q<vertebrae>.freeze, ["~> 0.5.0"])
121
- s.add_dependency(%q<rspec>.freeze, ["~> 3.7"])
122
- s.add_dependency(%q<webmock>.freeze, ["~> 3.3"])
123
- s.add_dependency(%q<byebug>.freeze, [">= 10.0.2", "< 11.0"])
113
+ s.add_dependency(%q<vertebrae>.freeze, [">= 0.6.0"])
124
114
  s.add_dependency(%q<bundler>.freeze, [">= 2.0", "< 3.0"])
125
- s.add_dependency(%q<eventmachine>.freeze, [">= 1.2.5", "< 2.0"])
126
- s.add_dependency(%q<em-synchrony>.freeze, [">= 1.0.6", "< 2.0"])
115
+ s.add_dependency(%q<byebug>.freeze, [">= 0"])
127
116
  s.add_dependency(%q<em-http-request>.freeze, [">= 1.1.5", "< 2.0"])
128
- s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9", "< 3.0"])
117
+ s.add_dependency(%q<em-synchrony>.freeze, [">= 1.0.6", "< 2.0"])
118
+ s.add_dependency(%q<eventmachine>.freeze, [">= 1.2.5", "< 2.0"])
119
+ s.add_dependency(%q<juwelier>.freeze, [">= 0"])
120
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.7"])
121
+ s.add_dependency(%q<rubocop>.freeze, [">= 0"])
122
+ s.add_dependency(%q<webmock>.freeze, ["~> 3.3"])
129
123
  end
130
124
  end
131
125
 
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Action < Base
3
5
  def base_path
4
6
  'action'
5
7
  end
6
8
  end
7
- end
9
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Actions
3
5
  class EventCreateAction < Action
@@ -9,11 +11,11 @@ module ActionKitRest
9
11
  ak_event_create_action = super
10
12
 
11
13
  # Aggregate fields parsed from referrenced entities' URI
12
- ak_event_create_action.obj['event_id'] = ak_event_create_action.event.match(/\/rest\/v1\/event\/(\d*)\//)[1]
13
- ak_event_create_action.obj['user_id'] = ak_event_create_action.user.match(/\/rest\/v1\/user\/(\d*)\//)[1]
14
+ ak_event_create_action.obj['event_id'] = ak_event_create_action.event.match(%r{/rest/v1/event/(\d*)/})[1]
15
+ ak_event_create_action.obj['user_id'] = ak_event_create_action.user.match(%r{/rest/v1/user/(\d*)/})[1]
14
16
 
15
17
  ak_event_create_action
16
18
  end
17
19
  end
18
20
  end
19
- end
21
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Actions
3
5
  class EventSignupAction < Action
@@ -9,11 +11,12 @@ module ActionKitRest
9
11
  ak_event_signup_action = super
10
12
 
11
13
  # Aggregate fields parsed from referrenced entities' URI
12
- ak_event_signup_action.obj['event_signup_id'] = ak_event_signup_action.signup.match(/\/rest\/v1\/eventsignup\/(\d*)\//)[1]
13
- ak_event_signup_action.obj['user_id'] = ak_event_signup_action.user.match(/\/rest\/v1\/user\/(\d*)\//)[1]
14
+ ak_event_signup_action.obj['event_signup_id'] =
15
+ ak_event_signup_action.signup.match(%r{/rest/v1/eventsignup/(\d*)/})[1]
16
+ ak_event_signup_action.obj['user_id'] = ak_event_signup_action.user.match(%r{/rest/v1/user/(\d*)/})[1]
14
17
 
15
18
  ak_event_signup_action
16
19
  end
17
20
  end
18
21
  end
19
- end
22
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Actions
3
5
  class UnsubscribeAction < Action
@@ -6,4 +8,4 @@ module ActionKitRest
6
8
  end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class AllowedUserField < Base
3
5
  def base_path
@@ -14,7 +16,7 @@ module ActionKitRest
14
16
  # We must override this, because the paths for allowed user fields use the name,
15
17
  # not a numerical ID.
16
18
  def extract_id_from_response(resp)
17
- resp.response.headers["location"].split('/').last
19
+ resp.response.headers['location'].split('/').last
18
20
  end
19
21
  end
20
22
  end
@@ -1,8 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class API < Vertebrae::API
3
-
4
5
  def request(*args)
5
- ActionKitRest::Response::Wrapper.new( super(*args) )
6
+ ActionKitRest::Response::Wrapper.new(super(*args))
6
7
  end
7
8
 
8
9
  def post_json_request(path, params)
@@ -18,10 +19,10 @@ module ActionKitRest
18
19
  end
19
20
 
20
21
  def extract_data_from_params(params) # :nodoc:
21
- if params.has_key?('data') && params['data'].present?
22
- return params['data']
22
+ if params.key?('data') && params['data'].present?
23
+ params['data']
23
24
  else
24
- return params
25
+ params
25
26
  end
26
27
  end
27
28
 
@@ -38,7 +39,8 @@ module ActionKitRest
38
39
  builder.use Faraday::Request::Multipart
39
40
  builder.use Faraday::Request::UrlEncoded
40
41
  if connection.configuration.authenticated?
41
- builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, connection.configuration.password
42
+ builder.use Faraday::Request::BasicAuthentication, connection.configuration.username,
43
+ connection.configuration.password
42
44
  end
43
45
 
44
46
  builder.use Faraday::Response::Logger if ENV['DEBUG']
@@ -46,7 +48,7 @@ module ActionKitRest
46
48
  builder.use FaradayMiddleware::Mashify
47
49
  builder.use FaradayMiddleware::ParseJson
48
50
 
49
- builder.use ActionKitRest::Response::RaiseError
51
+ builder.use ActionKitRest::Response::RaiseError
50
52
  builder.adapter connection.configuration.adapter
51
53
  end
52
54
  end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Base < Vertebrae::Model
3
-
4
5
  def list(filters = {})
5
6
  client.get_request(normalized_base_path, filters)
6
7
  end
@@ -31,11 +32,11 @@ module ActionKitRest
31
32
  end
32
33
 
33
34
  def extract_id_from_response(resp)
34
- extract_id_from_location(resp.response.headers["location"])
35
+ extract_id_from_location(resp.response.headers['location'])
35
36
  end
36
37
 
37
38
  def extract_id_from_location(location)
38
- location.scan(/\/(\d+)\/$/).first.first
39
+ location.scan(%r{/(\d+)/$}).first.first
39
40
  end
40
41
  end
41
- end
42
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'action_kit_rest/api'
2
4
 
3
5
  module ActionKitRest
@@ -9,19 +11,19 @@ module ActionKitRest
9
11
  self.clients = {}
10
12
  end
11
13
 
12
- [:import, :signup, :donation, :unsubscribe, :event_campaign].each do |page_type|
14
+ %i[import signup donation unsubscribe event_campaign].each do |page_type|
13
15
  define_method "#{page_type}_page" do
14
16
  clients["#{page_type}_page"] ||= ("ActionKitRest::Pages::#{page_type.to_s.classify}Page".constantize).new(client: self)
15
17
  end
16
18
  end
17
19
 
18
- [:unsubscribe, :event_create, :event_signup].each do |action|
20
+ %i[unsubscribe event_create event_signup].each do |action|
19
21
  define_method "#{action}_action" do
20
22
  clients["#{action}_action"] ||= ("ActionKitRest::Actions::#{action.to_s.classify}Action".constantize).new(client: self)
21
23
  end
22
24
  end
23
25
 
24
- [:action, :page, :tag, :list, :user, :phone, :event, :language, :event_signup, :allowed_user_field].each do |thing|
26
+ %i[action page tag list user phone event language event_signup allowed_user_field].each do |thing|
25
27
  define_method thing do
26
28
  clients[thing] ||= ("ActionKitRest::#{thing.to_s.classify}".constantize).new(client: self)
27
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Event < Base
3
5
  def base_path
@@ -9,4 +11,4 @@ module ActionKitRest
9
11
  response.obj.first
10
12
  end
11
13
  end
12
- end
14
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class EventSignup < Base
3
5
  def base_path
4
6
  'eventsignup'
5
7
  end
6
8
  end
7
- end
9
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Language < Base
3
5
  def base_path
@@ -9,4 +11,4 @@ module ActionKitRest
9
11
  response.obj.first
10
12
  end
11
13
  end
12
- end
14
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class List < Base
3
5
  def base_path
@@ -9,4 +11,4 @@ module ActionKitRest
9
11
  response.obj.first
10
12
  end
11
13
  end
12
- end
14
+ end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Page < Vertebrae::Model
3
5
  def list
4
- client.get_request("page/")
6
+ client.get_request('page/')
5
7
  end
6
8
 
7
9
  def get(id)
8
10
  client.get_request("page/#{id}/")
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Pages
3
5
  class Base < ActionKitRest::Base
@@ -6,15 +8,12 @@ module ActionKitRest
6
8
  response = list(name: name)
7
9
  response.obj.first
8
10
  end
9
-
11
+
10
12
  def find_or_create(params)
11
13
  page = find(params[:name])
12
- if page.blank?
13
- page = create(params)
14
- end
14
+ page = create(params) if page.blank?
15
15
  page
16
16
  end
17
17
  end
18
18
  end
19
19
  end
20
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Pages
3
5
  class DonationPage < ActionKitRest::Pages::Base
@@ -6,4 +8,4 @@ module ActionKitRest
6
8
  end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Pages
3
5
  class EventCampaignPage < ActionKitRest::Pages::Base
@@ -41,7 +43,7 @@ module ActionKitRest
41
43
 
42
44
  def create_event_create_page(event_campaign, tags)
43
45
  params = event_create_page_params(event_campaign, tags)
44
- response = client.post_json_request('eventcreatepage/', params)
46
+ _response = client.post_json_request('eventcreatepage/', params)
45
47
 
46
48
  params[:name]
47
49
  end
@@ -57,7 +59,7 @@ module ActionKitRest
57
59
 
58
60
  def create_event_signup_page(event_campaign, tags)
59
61
  params = event_signup_page_params(event_campaign, tags)
60
- response = client.post_json_request('eventsignuppage/', params)
62
+ _response = client.post_json_request('eventsignuppage/', params)
61
63
 
62
64
  params[:name]
63
65
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Pages
3
5
  class ImportPage < ActionKitRest::Pages::Base
@@ -6,4 +8,4 @@ module ActionKitRest
6
8
  end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Pages
3
5
  class SignupPage < ActionKitRest::Pages::Base
@@ -6,4 +8,4 @@ module ActionKitRest
6
8
  end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  module Pages
3
5
  class UnsubscribePage < ActionKitRest::Pages::Base
@@ -6,4 +8,4 @@ module ActionKitRest
6
8
  end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Phone < Base
3
5
  def base_path
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionKitRest
2
4
  class Railties < ::Rails::Railtie
3
5
  initializer 'Rails logger' do
4
6
  ActionKitRest.logger = Rails.logger
5
7
  end
6
8
  end
7
- end
9
+ end