Module: Prismic - - - -
--
-
- Defined in: -
- lib/prismic.rb,
- lib/prismic/api.rb,
lib/prismic/form.rb,
lib/prismic/version.rb,
lib/prismic/cache/lru.rb,
lib/prismic/predicates.rb,
lib/prismic/experiments.rb,
lib/prismic/json_parsers.rb,
lib/prismic/fragments/date.rb,
lib/prismic/fragments/link.rb,
lib/prismic/fragments/text.rb,
lib/prismic/with_fragments.rb,
lib/prismic/fragments/color.rb,
lib/prismic/fragments/embed.rb,
lib/prismic/fragments/group.rb,
lib/prismic/fragments/image.rb,
lib/prismic/fragments/number.rb,
lib/prismic/fragments/select.rb,
lib/prismic/fragments/slices.rb,
lib/prismic/fragments/fragment.rb,
lib/prismic/fragments/geopoint.rb,
lib/prismic/fragments/multiple.rb,
lib/prismic/fragments/separator.rb,
lib/prismic/fragments/timestamp.rb,
lib/prismic/fragments/structured_text.rb -
-
Defined Under Namespace
-- - - Modules: DefaultHTTPClient, Fragments, JsonParser, Predicates, WithFragments - - - - Classes: API, BasicNullCache, Document, Error, Experiment, Experiments, Field, Form, HtmlSerializer, LinkResolver, LruCache, Ref, Response, SearchForm, Variation - - -
- -Constant Summary
--
-
-
- EXPERIMENTS_COOKIE = - - -
'io.prismic.experiment'
-
- - PREVIEW_COOKIE = - - -
'io.prismic.preview'
-
- - VERSION = - - -
'1.4.3'
-
- - DefaultCache =
- -- ---
This default instance is used by the API to avoid creating a new instance -per request (which would make the cache useless).
- - -
- LruCache.new
-
-
- Class Method Summary - collapse -
- --
-
-
-
-
-
- .api(url, opts = nil) ⇒ API
-
-
-
-
-
-
-
-
-
-
-
-
-
- - -
Return an API instance The access token and HTTP client can be provided.
-
-
-
- - - - - .html_serializer(&blk) ⇒ Object - - - - - - - - - - - - - - - - - - -
-
-
-
- .link_resolver(ref) {|doc_link| ... } ⇒ LinkResolver
-
-
-
-
-
-
-
-
-
-
-
-
-
- - -
Build a LinkResolver instance The LinkResolver will help to build URL specific to an application, based on a generic prismic.io's Document link.
-
-
-
- -
-
-
- .oauth_check_token(url, oauth_opts, api_opts = nil) ⇒ String
-
-
-
-
-
-
-
-
-
-
-
-
-
- - -
Check a token and return an access_token.
-
-
-
- -
-
-
- .oauth_initiate_url(url, oauth_opts, api_opts = nil) ⇒ String
-
-
-
-
-
-
-
-
-
-
-
-
-
- - -
Build the URL where the user can be redirected to authenticated himself using OAuth2.
-
-
-
-
Class Method Details
- - -- - - .api(url) ⇒ API - - .api(url, opts) ⇒ API - - .api(url, access_token) ⇒ API - - - - - - -
Return an API instance -The access token and HTTP client can be provided.
- -The HTTP Client must responds to same method than DefaultHTTPClient.
- - -
- - - -64 -65 -66 -67 -68 -69 -70 -71- |
-
- # File 'lib/prismic.rb', line 64 - -def self.api(url, opts=nil) - if (not url =~ /\A#{URI::regexp(['http', 'https'])}\z/) - raise ArgumentError.new("Valid web URI expected") - end - opts ||= {} - opts = {access_token: opts} if opts.is_a?(String) - API.start(url, opts) -end- |
-
- - .html_serializer(&blk) ⇒ Object - - - - - -
- - - -637 -638 -639- |
-
- # File 'lib/prismic.rb', line 637 - -def self.html_serializer(&blk) - HtmlSerializer.new(&blk) -end- |
-
- - .link_resolver(ref) {|doc_link| ... } ⇒ LinkResolver - - - - - -
Build a LinkResolver instance -The LinkResolver will help to build URL specific to an application, based -on a generic prismic.io's Document link.
- - -
- - - -633 -634 -635- |
-
- # File 'lib/prismic.rb', line 633 - -def self.link_resolver(ref, &blk) - LinkResolver.new(ref, &blk) -end- |
-
- - .oauth_check_token(url, oauth_opts, api_opts = nil) ⇒ String - - - - - -
Check a token and return an access_token
- -This method allows to check the token received when the user has been -redirected from the OAuth2 server. It returns an access_token that can -be used to authenticate the user on the API.
- - -
- - - -115 -116 -117 -118 -119- |
-
- # File 'lib/prismic.rb', line 115 - -def self.oauth_check_token(url, oauth_opts, api_opts=nil) - api_opts ||= {} - api_opts = {access_token: api_opts} if api_opts.is_a?(String) - API.oauth_check_token(url, oauth_opts, api_opts) -end- |
-
- - .oauth_initiate_url(url, oauth_opts, api_opts = nil) ⇒ String - - - - - -
Build the URL where the user can be redirected to authenticated himself -using OAuth2. -@note: The endpoint depends on the repository, so an API call is made to -fetch it.
- - -
- - - -92 -93 -94 -95 -96- |
-
- # File 'lib/prismic.rb', line 92 - -def self.oauth_initiate_url(url, oauth_opts, api_opts=nil) - api_opts ||= {} - api_opts = {access_token: api_opts} if api_opts.is_a?(String) - API.oauth_initiate_url(url, oauth_opts, api_opts) -end- |
-

