yext-api 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 3d1170885002e5072f44f0f873aa18f25e3d6419
4
- data.tar.gz: 3b4ba378a817f1a787585bbd5b1457c76aa04b50
3
+ metadata.gz: b00aa1601c943ccd86176b00dbd9d0dc2cfe62ba
4
+ data.tar.gz: 3dc9545705404a5c812be0d70e77d57f6f61e8e2
5
5
  SHA512:
6
- metadata.gz: ef7ae532a5fe16b3d5857404da8ef200377aadaffb5c7394228c02761186d3ee9ef7d72e2bfc04c288723a142059c10492333f762e5d2480f6b16a8962b4005b
7
- data.tar.gz: a8002cc64bd89449bb34ad92a1a8e7820a34179e8683fcaa1ff12f6474c7e49750d098ade37ea2d8edd0369eb202a6202a7f8a9d1c59a49ca14936615fc6dc82
6
+ metadata.gz: 55c0f57e48913eddf4ae516022b76ecc9a44ff5b257280b1aa56d4c28e66df12f8023128ea8d2de1443a07e6713b5a43a0ab16e6ab0bbc7157ee6ad6cf9331bf
7
+ data.tar.gz: 01d6deaaaaedac4668c22ad2808c1d39fa7ad5e6f6bc7478c144b34e0726811229f0b84b8cbc83c4628eafbdb6f1e2795882c3c9e2b7f8bcf9a2717722ac7411
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yext-api (0.1.4)
4
+ yext-api (0.1.5)
5
5
  memoist (~> 0)
6
6
  rails (> 4)
7
7
  spyke (~> 5)
8
+ valid (~> 1)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
@@ -164,6 +165,7 @@ GEM
164
165
  tzinfo (1.2.4)
165
166
  thread_safe (~> 0.1)
166
167
  url (0.3.2)
168
+ valid (1.2.0)
167
169
  vcr (4.0.0)
168
170
  webmock (3.2.1)
169
171
  addressable (>= 2.3.6)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "validation"
4
+ require "validation/rule/not_empty"
@@ -793,6 +793,8 @@
793
793
  :default_version: 20161012
794
794
  :documentation: http://developer.yext.com/docs/api-reference/#operation/getOptimizationTasks
795
795
  :sandbox_only: false
796
+ :optimization_link:
797
+ :actions:
796
798
  - :action: :show
797
799
  :method: :get
798
800
  :endpoint: https://api.yext.com/v2/accounts/{accountId}/optimizationlink
@@ -37,7 +37,7 @@ module Yext
37
37
  # Furthermore, the account_id cannot be changed by the partner, but only by the customer
38
38
  # themselves.
39
39
  def save
40
- return unless accountId?
40
+ return unless Yext::Api::Validators::AccountValidator.new(self).valid?
41
41
 
42
42
  updates = { account_id: account_id, accountName: accountName }
43
43
  updates[:accountId] = accountId if accountId != account_id
@@ -29,8 +29,8 @@ module Yext
29
29
  next if account_class.association?(klass)
30
30
 
31
31
  klass_uri = klass.instance_variable_get(:@uri)
32
- helper_warnings(account_class, klass, klass_uri)
33
32
  klass_uri ||= klass.send(:default_uri)
33
+ helper_warnings(account_class, klass, klass_uri)
34
34
 
35
35
  add_has_many_relation(account_class, klass, klass_uri)
36
36
  end
@@ -26,6 +26,14 @@ module Yext
26
26
  has_many :users, class_name: "Yext::Api::KnowledgeApi::AccountSettings::User"
27
27
  has_many :roles, class_name: "Yext::Api::KnowledgeApi::AccountSettings::Role"
28
28
 
29
+ # KnowledgeApi::OptimizationTasks
30
+ has_many :optimization_tasks,
31
+ class_name: "Yext::Api::KnowledgeApi::OptimizationTasks::OptimizationTask",
32
+ uri: Yext::Api::Concerns::AccountChild.with_account_path("optimizationtasks/(:id)")
33
+ has_many :optimization_links,
34
+ class_name: "Yext::Api::KnowledgeApi::OptimizationTasks::OptimizationLink",
35
+ uri: Yext::Api::Concerns::AccountChild.with_account_path("optimizationlink")
36
+
29
37
  # LiveApi
30
38
  has_many :live_locations, class_name: "Yext::Api::LiveApi::Location"
31
39
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yext
4
+ module Api
5
+ module Enumerations
6
+ class OptimizationLinkMode
7
+ include Yext::Api::Concerns::EnumAll
8
+
9
+ PENDING_ONLY = "PENDING_ONLY"
10
+ ALL_TASKS = "ALL_TASKS"
11
+ RESET = "RESET"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yext
4
+ module Api
5
+ module KnowledgeApi
6
+ module OptimizationTasks
7
+ # :knowledge_api:
8
+ # :knowledge_manager:
9
+ # :optimization_link:
10
+ # - :action: :show
11
+ # :method: :get
12
+ # :endpoint: https://api.yext.com/v2/accounts/{accountId}/optimizationlink
13
+ # :path_regex: v2/accounts/[^/]+?/optimizationlink
14
+ # :default_version: 20161012
15
+ # :documentation: http://developer.yext.com/docs/api-reference/#operation/getLinkOptimizationTask
16
+ # :sandbox_only: false
17
+ class OptimizationLink < Yext::Api::Utils::ApiBase
18
+ uri "optimizationlink"
19
+
20
+ include Yext::Api::Concerns::AccountChild
21
+
22
+ scope :location, ->(location_id) { where(locationId: location_id) }
23
+
24
+ scope :task, ->(task_id) { tasks(task_id) }
25
+ scope :tasks, ->(*task_id_array) { where(taskIds: Array.wrap(task_id_array).join(",")) }
26
+
27
+ scope :mode, ->(mode) { where(mode: mode) }
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yext
4
+ module Api
5
+ module KnowledgeApi
6
+ module OptimizationTasks
7
+ # :knowledge_api:
8
+ # :knowledge_manager:
9
+ # :optimization_task:
10
+ # - :action: :index
11
+ # :method: :get
12
+ # :endpoint: https://api.yext.com/v2/accounts/{accountId}/optimizationtasks
13
+ # :path_regex: v2/accounts/[^/]+?/optimizationtasks
14
+ # :default_version: 20161012
15
+ # :documentation: http://developer.yext.com/docs/api-reference/#operation/getOptimizationTasks
16
+ # :sandbox_only: false
17
+ class OptimizationTask < Yext::Api::Utils::ApiBase
18
+ uri default_uri.delete("_")
19
+
20
+ include Yext::Api::Concerns::AccountChild
21
+
22
+ scope :location, ->(location_id) { locations(location_id) }
23
+ scope :locations, ->(*location_id_array) { where(locationIds: Array.wrap(location_id_array).join(",")) }
24
+
25
+ scope :task, ->(task_id) { tasks(task_id) }
26
+ scope :tasks, ->(*task_id_array) { where(taskIds: Array.wrap(task_id_array).join(",")) }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yext
4
+ module Api
5
+ module Validators
6
+ # A Validator for account updates to verify that the update is valid.
7
+ class AccountValidator < Validation::Validator
8
+ include Validation
9
+
10
+ def initialize(obj)
11
+ # Ensure that the accountId field exists by cloning the Account and setting it.
12
+ obj = Yext::Api::AdministrativeApi::Account.new(obj.attributes)
13
+ obj.accountId = obj[:accountId]
14
+
15
+ super(obj)
16
+ end
17
+
18
+ rule :accountId, :not_empty
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yext
4
4
  module Api
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
  end
7
7
  end
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "memoist", "~> 0"
34
34
  spec.add_dependency "rails", "> 4"
35
35
  spec.add_dependency "spyke", "~> 5"
36
+ spec.add_dependency "valid", "~> 1"
36
37
 
37
38
  spec.add_development_dependency "bundler"
38
39
  spec.add_development_dependency "codecov"
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.4
4
+ version: 0.1.5
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-15 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memoist
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: valid
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -231,6 +245,7 @@ files:
231
245
  - bin/setup
232
246
  - config/initializers/memoist.rb
233
247
  - config/initializers/spyke.rb
248
+ - config/initializers/valid.rb
234
249
  - config/routes.rb
235
250
  - lib/config/api.yml
236
251
  - lib/yext/api.rb
@@ -263,6 +278,7 @@ files:
263
278
  - lib/yext/api/enumerations/error_codes/suppression_errors.rb
264
279
  - lib/yext/api/enumerations/error_codes/users_errors.rb
265
280
  - lib/yext/api/enumerations/location_type.rb
281
+ - lib/yext/api/enumerations/optimization_link_mode.rb
266
282
  - lib/yext/api/enumerations/validation.rb
267
283
  - lib/yext/api/knowledge_api.rb
268
284
  - lib/yext/api/knowledge_api/account_settings/account.rb
@@ -271,6 +287,8 @@ files:
271
287
  - lib/yext/api/knowledge_api/health_check/health.rb
272
288
  - lib/yext/api/knowledge_api/knowledge_manager/category.rb
273
289
  - lib/yext/api/knowledge_api/knowledge_manager/location.rb
290
+ - lib/yext/api/knowledge_api/optimization_tasks/optimization_link.rb
291
+ - lib/yext/api/knowledge_api/optimization_tasks/optimization_task.rb
274
292
  - lib/yext/api/live_api.rb
275
293
  - lib/yext/api/live_api/location.rb
276
294
  - lib/yext/api/utils/api_base.rb
@@ -281,6 +299,7 @@ files:
281
299
  - lib/yext/api/utils/middleware/response_parser.rb
282
300
  - lib/yext/api/utils/middleware/uri_cleanup.rb
283
301
  - lib/yext/api/utils/params.rb
302
+ - lib/yext/api/validators/account_validator.rb
284
303
  - lib/yext/api/version.rb
285
304
  - lib/yext/include_rails.rb
286
305
  - yext-api.gemspec