yext-api 0.1.5 → 0.1.11

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.
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yext
4
+ module Api
5
+ module KnowledgeApi
6
+ module Powerlistings
7
+ # :knowledge_api:
8
+ # :powerlistings:
9
+ # :listing:
10
+ # - :action: :index
11
+ # :method: :get
12
+ # :endpoint: https://api.yext.com/v2/accounts/{accountId}/powerlistings/publishers
13
+ # :path_regex: v2/accounts/[^/]+?/powerlistings/publishers
14
+ # :default_version: 20161012
15
+ # :documentation: http://developer.yext.com/docs/api-reference/#operation/listPublishers
16
+ # :sandbox_only: false
17
+ class Publisher < Yext::Api::Utils::ApiBase
18
+ uri "powerlistings/#{default_uri}"
19
+
20
+ include Yext::Api::Concerns::AccountChild
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -55,23 +55,6 @@ module Yext
55
55
  #
56
56
  # sandbox
57
57
  # Boolean that indicates if the gem should use the production or sandbox URL.
58
- #
59
- # default_callback_processor
60
- # The default class to be used to process webhook messages that are called.
61
- # The code will warn about any missing webhook messages in a default processor.
62
- # set_callback_processor(callback_function_name, processor)
63
- # The class to be used to process webhook messages for a specific callback.
64
- # If the method callback_function_name is not a public instance method for processor, an error
65
- # will be raised.
66
- #
67
- # The processor class must be able to be instanciated with the following arguments:
68
- # * meta - a hash of metadata for the webhook
69
- # * object - a Spyke::Base object that represents the object that ws updated or changed
70
- # to cause the hook event.
71
- # * language_profiles - (optional) An array of objects.
72
- #
73
- # The functions that can be called for the webhooks are:
74
- # * add_request_changed
75
58
  class Configuration
76
59
  include Singleton
77
60
 
@@ -100,80 +83,8 @@ module Yext
100
83
  account_id || "me"
101
84
  end
102
85
 
103
- def default_callback_processor=(value)
104
- callback_names.each do |callback_name|
105
- verify_method(value, callback_name)
106
- end
107
-
108
- callback_processors[:default] = value
109
- end
110
-
111
- def default_callback_processor
112
- callback_processors[:default]
113
- end
114
-
115
- def set_callback_processor(callback_function_name, processor)
116
- callback_function_name = callback_function_name.downcase.to_sym
117
-
118
- validate_arguments(callback_function_name, processor)
119
-
120
- if processor.present?
121
- callback_processors[callback_function_name.downcase.to_sym] = processor
122
- else
123
- callback_processors.delete(callback_function_name.downcase.to_sym)
124
- end
125
- end
126
-
127
- def get_callback_processor(callback_function_name)
128
- callback_function_name = callback_function_name.downcase.to_sym
129
-
130
- callback_processors.fetch(callback_function_name, callback_processors[:default])
131
- end
132
-
133
86
  private
134
87
 
135
- def validate_arguments(callback_function_name, processor)
136
- raise ArgumentError, "invalid callback function #{callback_function_name}" unless callback_names.include?(callback_function_name)
137
-
138
- return if verify_method(processor, callback_function_name)
139
-
140
- raise ArgumentError, "#{processor.name} does not have a valid #{callback_function_name} function"
141
- end
142
-
143
- def callback_processors
144
- @callback_processors ||= {}
145
- end
146
-
147
- def callback_names
148
- %i[add_request_changed].dup
149
- end
150
-
151
- def verify_method(callback_class, method_name)
152
- return true if callback_class.blank?
153
- return true if valid_method_definition?(callback_class, method_name)
154
-
155
- warning_messsage = "The callback_processor does not include a valid #{method_name} method."
156
- if Object.const_defined?("Rails")
157
- Rails.logger.warn warning_messsage
158
- else
159
- # :nocov:
160
- puts warning_messsage
161
- # :nocov:
162
- end
163
-
164
- false
165
- end
166
-
167
- def valid_method_definition?(callback_class, method_name)
168
- return false if callback_class.public_instance_methods.grep(method_name).blank?
169
-
170
- method = callback_class.instance_method(method_name)
171
-
172
- return true if method.parameters.length.zero?
173
-
174
- method.parameters.count { |param_details| %i[keyreq req].include?(param_details.first) }.zero?
175
- end
176
-
177
88
  def read_from_environment_variables
178
89
  @sandbox = !Rails.env.production?
179
90
 
@@ -4,8 +4,9 @@ module Yext
4
4
  module Api
5
5
  module Validators
6
6
  # A Validator for account updates to verify that the update is valid.
7
- class AccountValidator < Validation::Validator
8
- include Validation
7
+ class AccountValidator < ::Validation::Validator
8
+ include ::Validation
9
+ extend ::Validation::Rules
9
10
 
10
11
  def initialize(obj)
11
12
  # Ensure that the accountId field exists by cloning the Account and setting it.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yext
4
4
  module Api
5
- VERSION = "0.1.5"
5
+ VERSION = "0.1.11"
6
6
  end
7
7
  end
@@ -39,8 +39,9 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "codecov"
40
40
  spec.add_development_dependency "cornucopia"
41
41
  spec.add_development_dependency "hashie"
42
- spec.add_development_dependency "rake", "~> 10"
42
+ spec.add_development_dependency "rake", "~> 13"
43
43
  spec.add_development_dependency "rspec"
44
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
44
45
  spec.add_development_dependency "rspec-rails"
45
46
  spec.add_development_dependency "simplecov"
46
47
  spec.add_development_dependency "simplecov-rcov"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yext-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - CardTapp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memoist
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '10'
131
+ version: '13'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '10'
138
+ version: '13'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec_junit_formatter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.4.1
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.4.1
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rspec-rails
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -227,6 +241,7 @@ executables: []
227
241
  extensions: []
228
242
  extra_rdoc_files: []
229
243
  files:
244
+ - ".circleci/config.yml"
230
245
  - ".gitignore"
231
246
  - ".rspec"
232
247
  - ".rubocop.yml"
@@ -240,6 +255,7 @@ files:
240
255
  - Rakefile
241
256
  - app/controllers/yext/api/agreements/add_request_controller.rb
242
257
  - app/controllers/yext/api/application_controller.rb
258
+ - app/controllers/yext/api/powerlistings/listing_controller.rb
243
259
  - bin/console
244
260
  - bin/rails
245
261
  - bin/setup
@@ -248,6 +264,7 @@ files:
248
264
  - config/initializers/valid.rb
249
265
  - config/routes.rb
250
266
  - lib/config/api.yml
267
+ - lib/yext-api.rb
251
268
  - lib/yext/api.rb
252
269
  - lib/yext/api/administrative_api.rb
253
270
  - lib/yext/api/administrative_api/account.rb
@@ -260,6 +277,7 @@ files:
260
277
  - lib/yext/api/concerns/faraday_connection.rb
261
278
  - lib/yext/api/concerns/rate_limits.rb
262
279
  - lib/yext/api/engine.rb
280
+ - lib/yext/api/enumerations/add_request_location_mode.rb
263
281
  - lib/yext/api/enumerations/add_request_status.rb
264
282
  - lib/yext/api/enumerations/error_codes.rb
265
283
  - lib/yext/api/enumerations/error_codes/agreements_errors.rb
@@ -277,6 +295,7 @@ files:
277
295
  - lib/yext/api/enumerations/error_codes/subscriptions_errors.rb
278
296
  - lib/yext/api/enumerations/error_codes/suppression_errors.rb
279
297
  - lib/yext/api/enumerations/error_codes/users_errors.rb
298
+ - lib/yext/api/enumerations/listing_status.rb
280
299
  - lib/yext/api/enumerations/location_type.rb
281
300
  - lib/yext/api/enumerations/optimization_link_mode.rb
282
301
  - lib/yext/api/enumerations/validation.rb
@@ -289,6 +308,8 @@ files:
289
308
  - lib/yext/api/knowledge_api/knowledge_manager/location.rb
290
309
  - lib/yext/api/knowledge_api/optimization_tasks/optimization_link.rb
291
310
  - lib/yext/api/knowledge_api/optimization_tasks/optimization_task.rb
311
+ - lib/yext/api/knowledge_api/powerlistings/listing.rb
312
+ - lib/yext/api/knowledge_api/powerlistings/publisher.rb
292
313
  - lib/yext/api/live_api.rb
293
314
  - lib/yext/api/live_api/location.rb
294
315
  - lib/yext/api/utils/api_base.rb
@@ -298,7 +319,6 @@ files:
298
319
  - lib/yext/api/utils/middleware/default_parameters.rb
299
320
  - lib/yext/api/utils/middleware/response_parser.rb
300
321
  - lib/yext/api/utils/middleware/uri_cleanup.rb
301
- - lib/yext/api/utils/params.rb
302
322
  - lib/yext/api/validators/account_validator.rb
303
323
  - lib/yext/api/version.rb
304
324
  - lib/yext/include_rails.rb
@@ -323,8 +343,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
343
  - !ruby/object:Gem::Version
324
344
  version: '0'
325
345
  requirements: []
326
- rubyforge_project:
327
- rubygems_version: 2.5.1
346
+ rubygems_version: 3.0.3
328
347
  signing_key:
329
348
  specification_version: 4
330
349
  summary: An interface gem to the Yext API.
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Yext
4
- module Api
5
- module Utils
6
- # A utility class for performing normal modifications to webhooks to convert/normalize data
7
- # before passing it along so that the receiver doesn't have to worry/thnk about it.
8
- class Params
9
- attr_reader :params
10
-
11
- def initialize(params)
12
- @params = params
13
- end
14
-
15
- # Converts an integer epoch date value into a Time.
16
- #
17
- # The param_names is a list of nodes which ends with a leaf node that is the epoch value
18
- # to be converted to a Time.
19
- #
20
- # If any node along the way cannot be found, the function exits without errors or changing any values.
21
- def convert_epoch(*param_names)
22
- return unless param_names.present?
23
-
24
- param_name = param_names[-1]
25
- param_level = find_value(*param_names)
26
-
27
- return unless param_level.present?
28
-
29
- param_level[param_name] = Time.at(param_level[param_name].to_i / 1_000.0)
30
- end
31
-
32
- # Converts time string into a Time.
33
- #
34
- # The param_names is a list of nodes which ends with a leaf node that is the time string
35
- # to be converted to a Time.
36
- #
37
- # If any node along the way cannot be found, the function exits without errors or changing any values.
38
- def convert_time(*param_names)
39
- return unless param_names.present?
40
-
41
- param_name = param_names[-1]
42
- param_level = find_value(*param_names)
43
-
44
- return unless param_level.present?
45
-
46
- param_level[param_name] = param_level[param_name].to_time(:utc)
47
- end
48
-
49
- private
50
-
51
- def find_value(*param_names)
52
- param_level = params
53
- found_param = param_names[0..-2].each do |param_name|
54
- break unless param_level.key?(param_name)
55
-
56
- param_level = param_level[param_name]
57
- end
58
-
59
- return if found_param.nil?
60
-
61
- param_name = param_names[-1]
62
- return unless param_level.key?(param_name) && param_level[param_name].present?
63
-
64
- param_level
65
- end
66
- end
67
- end
68
- end
69
- end