yext-api 0.1.1
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.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.rspec +3 -0
- data/.rubocop.yml +100 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +187 -0
- data/LICENSE.txt +21 -0
- data/README.md +206 -0
- data/Rakefile +30 -0
- data/app/assets/config/yext_api_manifest.js +2 -0
- data/app/assets/images/yext/api/.keep +0 -0
- data/app/assets/javascripts/yext/api/application.js +13 -0
- data/app/assets/stylesheets/yext/api/application.css +15 -0
- data/app/controllers/yext/api/application_controller.rb +12 -0
- data/app/docs/notes.txt +45 -0
- data/app/helpers/yext/api/application_helper.rb +11 -0
- data/app/jobs/yext/api/application_job.rb +8 -0
- data/app/mailers/yext/api/application_mailer.rb +11 -0
- data/app/models/yext/api/application_record.rb +10 -0
- data/app/views/layouts/yext/api/application.html.erb +14 -0
- data/bin/console +16 -0
- data/bin/rails +16 -0
- data/bin/setup +8 -0
- data/config/initializers/spyke.rb +3 -0
- data/config/routes.rb +4 -0
- data/lib/config/api.yml +1100 -0
- data/lib/tasks/yext/api_tasks.rake +6 -0
- data/lib/yext/api.rb +33 -0
- data/lib/yext/api/administrative_api.rb +12 -0
- data/lib/yext/api/administrative_api/account.rb +62 -0
- data/lib/yext/api/administrative_api/add_request.rb +34 -0
- data/lib/yext/api/administrative_api/service.rb +38 -0
- data/lib/yext/api/concerns/account_child.rb +92 -0
- data/lib/yext/api/concerns/account_relations.rb +25 -0
- data/lib/yext/api/concerns/api_finder.rb +61 -0
- data/lib/yext/api/concerns/default_scopes.rb +37 -0
- data/lib/yext/api/concerns/enum_all.rb +18 -0
- data/lib/yext/api/concerns/faraday_connection.rb +45 -0
- data/lib/yext/api/concerns/rate_limits.rb +31 -0
- data/lib/yext/api/engine.rb +13 -0
- data/lib/yext/api/enumerations/validation.rb +16 -0
- data/lib/yext/api/knowledge_api.rb +12 -0
- data/lib/yext/api/knowledge_api/account_settings/account.rb +33 -0
- data/lib/yext/api/knowledge_api/health_check/health.rb +25 -0
- data/lib/yext/api/knowledge_api/knowledge_manager/category.rb +25 -0
- data/lib/yext/api/knowledge_api/knowledge_manager/location.rb +59 -0
- data/lib/yext/api/live_api.rb +12 -0
- data/lib/yext/api/live_api/location.rb +37 -0
- data/lib/yext/api/utils/api_base.rb +13 -0
- data/lib/yext/api/utils/api_rate_limits.rb +36 -0
- data/lib/yext/api/utils/configuration.rb +97 -0
- data/lib/yext/api/utils/default_parameters.rb +57 -0
- data/lib/yext/api/utils/response_parser.rb +84 -0
- data/lib/yext/api/version.rb +7 -0
- data/lib/yext/include_rails.rb +31 -0
- data/yext-api.gemspec +51 -0
- metadata +271 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8053aa37eff876ce5e19ea3adfc1cc612ba75e33
|
4
|
+
data.tar.gz: 5a2c361a2c6765727896f5d3dfe5cbda88d91ae0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a37ebb7efc5e369d9e379f9268be0129ab1c3ba85b735a0b1e130cc6c4995dd6b1ce741a80c59314e0416cdda6118e54b511fb8b46cbe3f005e6a377e52257e
|
7
|
+
data.tar.gz: e328357997e34cc2ff3620377e8b4d38a17c52210bf945ecceaff13f1f0fe6bcf9600287549ca8c007f57474a9c9db941e8d78a4b3bb0ed413c39cbcb3d00648
|
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
# rspec failure tracking
|
11
|
+
.rspec_status
|
12
|
+
|
13
|
+
# spec dummy project
|
14
|
+
log/*.log
|
15
|
+
spec/dummy/db/*.sqlite3
|
16
|
+
spec/dummy/db/*.sqlite3-journal
|
17
|
+
spec/dummy/log/*.log
|
18
|
+
spec/dummy/tmp/
|
19
|
+
|
20
|
+
# RubyMine IDE
|
21
|
+
.idea/
|
22
|
+
|
23
|
+
# Cornucopia
|
24
|
+
/spec/dummy/cornucopia_report/
|
25
|
+
/cornucopia_report/
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
Style/StringLiterals:
|
2
|
+
EnforcedStyle: double_quotes
|
3
|
+
SupportedStyles:
|
4
|
+
- single_quotes
|
5
|
+
- double_quotes
|
6
|
+
# If `true`, strings which span multiple lines using `\` for continuation must
|
7
|
+
# use the same type of quotes on each line.
|
8
|
+
ConsistentQuotesInMultiline: false
|
9
|
+
|
10
|
+
Style/FrozenStringLiteralComment:
|
11
|
+
EnforcedStyle: always
|
12
|
+
SupportedStyles:
|
13
|
+
# `when_needed` will add the frozen string literal comment to files
|
14
|
+
# only when the `TargetRubyVersion` is set to 2.3+.
|
15
|
+
- when_needed
|
16
|
+
# `always` will always add the frozen string literal comment to a file
|
17
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
18
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
19
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
20
|
+
- always
|
21
|
+
# `never` will enforce that the frozen string literal comment does not
|
22
|
+
# exist in a file.
|
23
|
+
- never
|
24
|
+
|
25
|
+
Layout/ExtraSpacing:
|
26
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
27
|
+
# things with the previous or next line, not counting empty lines or comment
|
28
|
+
# lines.
|
29
|
+
AllowForAlignment: true
|
30
|
+
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
31
|
+
ForceEqualSignAlignment: true
|
32
|
+
|
33
|
+
Metrics/LineLength:
|
34
|
+
Max: 150
|
35
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
36
|
+
# containing a URI to be longer than Max.
|
37
|
+
AllowHeredoc: true
|
38
|
+
AllowURI: true
|
39
|
+
URISchemes:
|
40
|
+
- http
|
41
|
+
- https
|
42
|
+
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
43
|
+
# directives like '# rubocop: enable ...' when calculating a line's length.
|
44
|
+
IgnoreCopDirectives: false
|
45
|
+
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
46
|
+
# elements. Strings will be converted to Regexp objects. A line that matches
|
47
|
+
# any regular expression listed in this option will be ignored by LineLength.
|
48
|
+
IgnoredPatterns: []
|
49
|
+
|
50
|
+
Layout/MultilineMethodCallIndentation:
|
51
|
+
EnforcedStyle: indented
|
52
|
+
SupportedStyles:
|
53
|
+
- aligned
|
54
|
+
- indented
|
55
|
+
- indented_relative_to_receiver
|
56
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
57
|
+
# But it can be overridden by setting this parameter
|
58
|
+
IndentationWidth: 4
|
59
|
+
|
60
|
+
# Multi-line method chaining should be done with leading dots.
|
61
|
+
Layout/DotPosition:
|
62
|
+
EnforcedStyle: trailing
|
63
|
+
SupportedStyles:
|
64
|
+
- leading
|
65
|
+
- trailing
|
66
|
+
|
67
|
+
# Checks the indentation of the first key in a hash literal.
|
68
|
+
Layout/IndentHash:
|
69
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
70
|
+
# that have their opening brace on the same line as a surrounding opening
|
71
|
+
# round parenthesis, shall have their first key indented relative to the
|
72
|
+
# first position inside the parenthesis.
|
73
|
+
#
|
74
|
+
# The value `consistent` means that the indentation of the first key shall
|
75
|
+
# always be relative to the first position of the line where the opening
|
76
|
+
# brace is.
|
77
|
+
#
|
78
|
+
# The value `align_braces` means that the indentation of the first key shall
|
79
|
+
# always be relative to the position of the opening brace.
|
80
|
+
EnforcedStyle: special_inside_parentheses
|
81
|
+
SupportedStyles:
|
82
|
+
- special_inside_parentheses
|
83
|
+
- consistent
|
84
|
+
- align_braces
|
85
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
86
|
+
# But it can be overridden by setting this parameter
|
87
|
+
IndentationWidth: 4
|
88
|
+
|
89
|
+
Metrics/BlockLength:
|
90
|
+
Exclude:
|
91
|
+
- spec/**/*
|
92
|
+
|
93
|
+
Layout/MultilineOperationIndentation:
|
94
|
+
EnforcedStyle: indented
|
95
|
+
SupportedStyles:
|
96
|
+
- aligned
|
97
|
+
- indented
|
98
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
99
|
+
# But it can be overridden by setting this parameter
|
100
|
+
IndentationWidth: 2
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at RealNobody1@cox.net. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
yext-api (0.1.0)
|
5
|
+
rails (~> 5.1.2)
|
6
|
+
spyke (~> 5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.1.4)
|
12
|
+
actionpack (= 5.1.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.1.4)
|
16
|
+
actionpack (= 5.1.4)
|
17
|
+
actionview (= 5.1.4)
|
18
|
+
activejob (= 5.1.4)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.1.4)
|
22
|
+
actionview (= 5.1.4)
|
23
|
+
activesupport (= 5.1.4)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.1.4)
|
29
|
+
activesupport (= 5.1.4)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.1.4)
|
35
|
+
activesupport (= 5.1.4)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.1.4)
|
38
|
+
activesupport (= 5.1.4)
|
39
|
+
activerecord (5.1.4)
|
40
|
+
activemodel (= 5.1.4)
|
41
|
+
activesupport (= 5.1.4)
|
42
|
+
arel (~> 8.0)
|
43
|
+
activesupport (5.1.4)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (~> 0.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
addressable (2.5.2)
|
49
|
+
public_suffix (>= 2.0.2, < 4.0)
|
50
|
+
arel (8.0.0)
|
51
|
+
builder (3.2.3)
|
52
|
+
concurrent-ruby (1.0.5)
|
53
|
+
cornucopia (0.1.40)
|
54
|
+
activesupport
|
55
|
+
crack (0.4.3)
|
56
|
+
safe_yaml (~> 1.0.0)
|
57
|
+
crass (1.0.3)
|
58
|
+
diff-lcs (1.3)
|
59
|
+
docile (1.1.5)
|
60
|
+
erubi (1.7.0)
|
61
|
+
faraday (0.13.1)
|
62
|
+
multipart-post (>= 1.2, < 3)
|
63
|
+
faraday_middleware (0.12.2)
|
64
|
+
faraday (>= 0.7.4, < 1.0)
|
65
|
+
gem-release (1.0.0)
|
66
|
+
globalid (0.4.1)
|
67
|
+
activesupport (>= 4.2.0)
|
68
|
+
hashdiff (0.3.7)
|
69
|
+
hashie (3.5.7)
|
70
|
+
i18n (0.9.1)
|
71
|
+
concurrent-ruby (~> 1.0)
|
72
|
+
json (2.1.0)
|
73
|
+
loofah (2.1.1)
|
74
|
+
crass (~> 1.0.2)
|
75
|
+
nokogiri (>= 1.5.9)
|
76
|
+
mail (2.7.0)
|
77
|
+
mini_mime (>= 0.1.1)
|
78
|
+
method_source (0.9.0)
|
79
|
+
mini_mime (1.0.0)
|
80
|
+
mini_portile2 (2.3.0)
|
81
|
+
minitest (5.11.1)
|
82
|
+
multipart-post (2.0.0)
|
83
|
+
nio4r (2.2.0)
|
84
|
+
nokogiri (1.8.1)
|
85
|
+
mini_portile2 (~> 2.3.0)
|
86
|
+
public_suffix (3.0.1)
|
87
|
+
rack (2.0.3)
|
88
|
+
rack-test (0.8.2)
|
89
|
+
rack (>= 1.0, < 3)
|
90
|
+
rails (5.1.4)
|
91
|
+
actioncable (= 5.1.4)
|
92
|
+
actionmailer (= 5.1.4)
|
93
|
+
actionpack (= 5.1.4)
|
94
|
+
actionview (= 5.1.4)
|
95
|
+
activejob (= 5.1.4)
|
96
|
+
activemodel (= 5.1.4)
|
97
|
+
activerecord (= 5.1.4)
|
98
|
+
activesupport (= 5.1.4)
|
99
|
+
bundler (>= 1.3.0)
|
100
|
+
railties (= 5.1.4)
|
101
|
+
sprockets-rails (>= 2.0.0)
|
102
|
+
rails-dom-testing (2.0.3)
|
103
|
+
activesupport (>= 4.2.0)
|
104
|
+
nokogiri (>= 1.6)
|
105
|
+
rails-html-sanitizer (1.0.3)
|
106
|
+
loofah (~> 2.0)
|
107
|
+
railties (5.1.4)
|
108
|
+
actionpack (= 5.1.4)
|
109
|
+
activesupport (= 5.1.4)
|
110
|
+
method_source
|
111
|
+
rake (>= 0.8.7)
|
112
|
+
thor (>= 0.18.1, < 2.0)
|
113
|
+
rake (10.4.2)
|
114
|
+
rspec (3.6.0)
|
115
|
+
rspec-core (~> 3.6.0)
|
116
|
+
rspec-expectations (~> 3.6.0)
|
117
|
+
rspec-mocks (~> 3.6.0)
|
118
|
+
rspec-core (3.6.0)
|
119
|
+
rspec-support (~> 3.6.0)
|
120
|
+
rspec-expectations (3.6.0)
|
121
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
122
|
+
rspec-support (~> 3.6.0)
|
123
|
+
rspec-mocks (3.6.0)
|
124
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
125
|
+
rspec-support (~> 3.6.0)
|
126
|
+
rspec-rails (3.6.1)
|
127
|
+
actionpack (>= 3.0)
|
128
|
+
activesupport (>= 3.0)
|
129
|
+
railties (>= 3.0)
|
130
|
+
rspec-core (~> 3.6.0)
|
131
|
+
rspec-expectations (~> 3.6.0)
|
132
|
+
rspec-mocks (~> 3.6.0)
|
133
|
+
rspec-support (~> 3.6.0)
|
134
|
+
rspec-support (3.6.0)
|
135
|
+
safe_yaml (1.0.4)
|
136
|
+
simplecov (0.15.1)
|
137
|
+
docile (~> 1.1.0)
|
138
|
+
json (>= 1.8, < 3)
|
139
|
+
simplecov-html (~> 0.10.0)
|
140
|
+
simplecov-html (0.10.2)
|
141
|
+
simplecov-rcov (0.2.3)
|
142
|
+
simplecov (>= 0.4.1)
|
143
|
+
sprockets (3.7.1)
|
144
|
+
concurrent-ruby (~> 1.0)
|
145
|
+
rack (> 1, < 3)
|
146
|
+
sprockets-rails (3.2.1)
|
147
|
+
actionpack (>= 4.0)
|
148
|
+
activesupport (>= 4.0)
|
149
|
+
sprockets (>= 3.0.0)
|
150
|
+
spyke (5.2.0)
|
151
|
+
activemodel (>= 4.0.0, < 6.0)
|
152
|
+
activesupport (>= 4.0.0, < 6.0)
|
153
|
+
addressable (>= 2.5.2)
|
154
|
+
faraday (>= 0.9.0, < 2.0)
|
155
|
+
faraday_middleware (>= 0.9.1, < 2.0)
|
156
|
+
thor (0.20.0)
|
157
|
+
thread_safe (0.3.6)
|
158
|
+
tzinfo (1.2.4)
|
159
|
+
thread_safe (~> 0.1)
|
160
|
+
vcr (4.0.0)
|
161
|
+
webmock (3.2.1)
|
162
|
+
addressable (>= 2.3.6)
|
163
|
+
crack (>= 0.3.2)
|
164
|
+
hashdiff
|
165
|
+
websocket-driver (0.6.5)
|
166
|
+
websocket-extensions (>= 0.1.0)
|
167
|
+
websocket-extensions (0.1.3)
|
168
|
+
|
169
|
+
PLATFORMS
|
170
|
+
ruby
|
171
|
+
|
172
|
+
DEPENDENCIES
|
173
|
+
bundler (~> 1.16)
|
174
|
+
cornucopia
|
175
|
+
gem-release
|
176
|
+
hashie
|
177
|
+
rake (~> 10.0)
|
178
|
+
rspec (~> 3.0)
|
179
|
+
rspec-rails
|
180
|
+
simplecov
|
181
|
+
simplecov-rcov
|
182
|
+
vcr
|
183
|
+
webmock
|
184
|
+
yext-api!
|
185
|
+
|
186
|
+
BUNDLED WITH
|
187
|
+
1.16.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 RealNobody
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
# Yext::Api
|
2
|
+
|
3
|
+
This gem provides a Rails interface with the Yext API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'yext-api'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install yext-api
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
This gem uses the [Spyke gem](https://github.com/balvig/spyke) to simplify the HTML calls and create
|
24
|
+
a familiar ActiveRecord type interface with Yext and the Yext objects. Please refer to that gem for
|
25
|
+
details on making calls, passing paraemters etc. if the documentation here is not sufficient.
|
26
|
+
|
27
|
+
### Configuration
|
28
|
+
|
29
|
+
To use the Yext API, you need to specify certain options like the account ID, the application ID, etc.
|
30
|
+
These options can be set to global defaults or set on a per-call basis.
|
31
|
+
|
32
|
+
A configuration option is avalable through `Yext::Api.configuration`. All configuration options can
|
33
|
+
be set through here. To confugure multiple items you can use `Yext::Api.configure`:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Yext::Api.configure do |configuration|
|
37
|
+
configuration.account_id = "your account_id"
|
38
|
+
configuration.api_key = "your application key"
|
39
|
+
configuration.api_version = "20161012"
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
The global configurations can be initialized with ENV values. The following configurations are available:
|
44
|
+
|
45
|
+
* `account_id` - `ENV["YEXT_ACCOUNT_ID"]`
|
46
|
+
This is the Account ID that is used in the path to API endpoints that require an account ID. This
|
47
|
+
value will default to `"me"` if not specified.
|
48
|
+
|
49
|
+
You can specify this on a per-call basis using `with_account("new account_id")`. This option is only
|
50
|
+
available for objects that require an account ID for all calls.
|
51
|
+
|
52
|
+
* `api_key` - `ENV["YEXT_API_KEY"]`
|
53
|
+
This is the API_KEY from the Yext Application that you are using.
|
54
|
+
|
55
|
+
You can specify this on a per-call basis using `with_application("new application key")`.
|
56
|
+
|
57
|
+
* `api_version` - `ENV["YEXT_API_VERSION"]`
|
58
|
+
This is the version number of the `v2` API endpoint to be used. This value be defaulted to the most
|
59
|
+
recent version of the API that the gem is aware of or `"2016101"`
|
60
|
+
|
61
|
+
You can specify this on a per-call basis using `with_version("new version")`.
|
62
|
+
|
63
|
+
* `yext_username` - `ENV["YEXT_USERNAME"]`
|
64
|
+
This is the username to be associated with changes in Yext. This option is available on all calls but
|
65
|
+
will only be used for `PUT`, `PATCH`, `CREATE`, and `DELETE` calls.
|
66
|
+
|
67
|
+
You can specify this on a per-call basis using `yext_username("your username")`.
|
68
|
+
|
69
|
+
* `yext_user_id` - `ENV["YEXT_USER_ID"]`
|
70
|
+
This is the ID of the user to be associated with changes in Yext. This option is available on all calls but
|
71
|
+
will only be used for `PUT`, `PATCH`, `CREATE`, and `DELETE` calls.
|
72
|
+
|
73
|
+
You can specify this on a per-call basis using `yext_user_id("your user_id")`.
|
74
|
+
|
75
|
+
* `validation_level` - `ENV["YEXT_VALIDATION_LEVEL"]`
|
76
|
+
The validation level to be used on the call. This value can only be `strict` or `lenient`.
|
77
|
+
Yext will default this if not specified to "strict" if you do not specify a value.
|
78
|
+
|
79
|
+
You can specify this on a per-call basis using:
|
80
|
+
* `validate(true)` (for strict)
|
81
|
+
* `validate(false)` (for lenient)
|
82
|
+
* `validate(Yext::Api::Enumerations::Validation::LENIENT)`
|
83
|
+
|
84
|
+
* `sandbox` - `!Rails.env.production?`
|
85
|
+
Wether or not to use the Sandbox API endpoint or the API endpoint. This option cannot be set on a
|
86
|
+
per-call basis. This option is ignored for all objects under the `LiveApi` namespace.
|
87
|
+
|
88
|
+
### General Usage
|
89
|
+
|
90
|
+
The API namespaces are setup to mimic the structure of the Yext API documentation to make it easier.
|
91
|
+
to find or guess at an objects name. Objects are defined based on the routes for those objects. The
|
92
|
+
following classes are planned based on that structure:
|
93
|
+
|
94
|
+
* AdministrativeApi::Account
|
95
|
+
* AdministrativeApi::AddRequest
|
96
|
+
* AdministrativeApi::Service
|
97
|
+
* KnowledgeApi::HealthCheck::Health
|
98
|
+
* KnowledgeApi::KnowledgeManager::Location
|
99
|
+
* KnowledgeApi::KnowledgeManager::Folder
|
100
|
+
* KnowledgeApi::KnowledgeManager::Menu
|
101
|
+
* KnowledgeApi::KnowledgeManager::Bio
|
102
|
+
* KnowledgeApi::KnowledgeManager::Product
|
103
|
+
* KnowledgeApi::KnowledgeManager::Event
|
104
|
+
* KnowledgeApi::KnowledgeManager::Category
|
105
|
+
* KnowledgeApi::KnowledgeManager::GoogleField
|
106
|
+
* KnowledgeApi::KnowledgeManager::CustomField
|
107
|
+
* KnowledgeApi::KnowledgeManager::LanguageProfile
|
108
|
+
* KnowledgeApi::KnowledgeManager::Asset
|
109
|
+
* KnowledgeApi::PowerListings::Publisher
|
110
|
+
* KnowledgeApi::PowerListings::Listing
|
111
|
+
* KnowledgeApi::PowerListings::PublisherSuggestion
|
112
|
+
* KnowledgeApi::Analytics::MaxDate
|
113
|
+
* KnowledgeApi::Analytics::Report
|
114
|
+
* KnowledgeApi::Analytics::Activity
|
115
|
+
* KnowledgeApi::Reviews::Review
|
116
|
+
* KnowledgeApi::Reviews::Comment
|
117
|
+
* KnowledgeApi::Reviews::ReviewInvitation
|
118
|
+
* KnowledgeApi::Reviews::ReviewGenerationSetting
|
119
|
+
* KnowledgeApi::Social::Post
|
120
|
+
* KnowledgeApi::Social::Comment
|
121
|
+
* KnowledgeApi::Social::LinkedAccount
|
122
|
+
* KnowledgeApi::AccountSettings::Role
|
123
|
+
* KnowledgeApi::AccountSettings::User
|
124
|
+
* KnowledgeApi::AccountSettings::Account
|
125
|
+
* KnowledgeApi::OptimizationTasks::OptimizationTask
|
126
|
+
* LiveApi::Menu
|
127
|
+
* LiveApi::Bio
|
128
|
+
* LiveApi::Product
|
129
|
+
* LiveApi::Event
|
130
|
+
* LiveApi::LanguageProfile
|
131
|
+
* LiveApi::LanguageProfileSchema
|
132
|
+
* LiveApi::Location
|
133
|
+
* LiveApi::LocationSchema
|
134
|
+
|
135
|
+
#### Fetching a list of objects
|
136
|
+
|
137
|
+
Use `all`:
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
Yext::Api::AdministrativeApi::Account.all.each do |account|
|
141
|
+
sku_match?(account.sku)
|
142
|
+
end
|
143
|
+
```
|
144
|
+
|
145
|
+
#### Fetching a single object
|
146
|
+
|
147
|
+
Use `find`
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
account = Yext::Api::AdministrativeApi::Account.find("my-id")
|
151
|
+
```
|
152
|
+
|
153
|
+
#### Overriding configuration options
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
other_account_services = Yext::Api::AdministrativeApi::Service.with_account("6664444").with_application("777821019292928").to_a
|
157
|
+
```
|
158
|
+
|
159
|
+
#### Using custom actions
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
available_services = Yext::Api::AdministrativeApi::Service.available.to_a
|
163
|
+
```
|
164
|
+
|
165
|
+
#### API Rate Limits
|
166
|
+
|
167
|
+
Yext returns rate limit information for each call. This information is different for each category of
|
168
|
+
API call, so it is stored in the base Namespace for each call.
|
169
|
+
|
170
|
+
NOTE: Accounts are listed in the API documentation in both the `AdministrativeApi` and the `KnowledgeApi`
|
171
|
+
namespaces. The `index` and `get` options are available in both locations, but the rate limites are
|
172
|
+
ONLY recorded in `KnowledgeApi`.
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
Yext::Api::AdministrativeApi::Service.all.to_a
|
176
|
+
|
177
|
+
# Now the following values are set based on the response.
|
178
|
+
Yext::Api::AdministrativeApi.rate_limit_limit
|
179
|
+
Yext::Api::AdministrativeApi.rate_limit_remaining
|
180
|
+
Yext::Api::AdministrativeApi.rate_limit_reset_at
|
181
|
+
```
|
182
|
+
|
183
|
+
## Development
|
184
|
+
|
185
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the
|
186
|
+
tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
187
|
+
|
188
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version,
|
189
|
+
update the version number in `version.rb`, and then run `bundle exec rake release`, which will create
|
190
|
+
a git tag for the version, push git commits and tags, and push the `.gem` file to
|
191
|
+
[rubygems.org](https://rubygems.org).
|
192
|
+
|
193
|
+
## Contributing
|
194
|
+
|
195
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yext-api. This
|
196
|
+
project is intended to be a safe, welcoming space for collaboration, and contributors are expected to
|
197
|
+
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
198
|
+
|
199
|
+
## License
|
200
|
+
|
201
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
202
|
+
|
203
|
+
## Code of Conduct
|
204
|
+
|
205
|
+
Everyone interacting in the Yext::Api project’s codebases, issue trackers, chat rooms and mailing lists
|
206
|
+
is expected to follow the [code of conduct](https://github.com/[USERNAME]/yext-api/blob/master/CODE_OF_CONDUCT.md).
|