buttercms-ruby 1.3.1 → 1.3.2
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 +4 -4
- data/README.md +25 -29
- data/VERSION +1 -1
- data/lib/buttercms-ruby.rb +2 -1
- data/lib/buttercms/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7b4c68f74294cbca04ea1d4c68fa40f241a5f92
|
4
|
+
data.tar.gz: 124e11b182d91dc136042d7a2ae35a09e4e19d2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4eb9a5fab1a68b855786b401a5870deb6d962d1b00bca58b2cfa1e44d975b5d5721361944c8192597c5b5866964f166411d46c38e4be88e4c460a3682c619fe
|
7
|
+
data.tar.gz: 8560d77aee2ad9615c0f6ec985a9badb83c6cf95e00ff35fac70289bf6421e89919670558f8e31351c4fc4561c56249755e49753cc6259e724f98857aa1c9395
|
data/README.md
CHANGED
@@ -23,12 +23,35 @@ To setup your project, follow these steps:
|
|
23
23
|
|
24
24
|
# Fetch content from test mode (eg. for your staging website)
|
25
25
|
# ButterCMS::test_mode = true
|
26
|
+
|
27
|
+
# Set read timeout (Default is 5.0)
|
28
|
+
# ButterCMS::read_timeout = 5.0
|
26
29
|
```
|
27
30
|
|
28
|
-
##
|
31
|
+
## Pages
|
29
32
|
|
30
33
|
```ruby
|
31
|
-
|
34
|
+
params = {foo: 'bar'} # optional
|
35
|
+
pages = ButterCMS::Page.list('news', params)
|
36
|
+
page = ButterCMS::Page.get('news', 'hello-world', params)
|
37
|
+
```
|
38
|
+
|
39
|
+
## Content Fields
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
ButterCMS::Content.fetch(['homepage_headline'])
|
43
|
+
|
44
|
+
# Localization
|
45
|
+
ButterCMS::Content.fetch(['homepage_headline'], locale: 'es')
|
46
|
+
|
47
|
+
# Test mode can be used to setup a staging website for previewing Content Fields or for testing content during local development. To fetch content from test mode add the following configuration:
|
48
|
+
ButterCMS::test_mode = true
|
49
|
+
```
|
50
|
+
|
51
|
+
## Blog Engine
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
posts = ButterCMS::Post.all({:page => 1, :page_size => 10})
|
32
55
|
puts posts.first.title
|
33
56
|
puts posts.meta.next_page
|
34
57
|
|
@@ -49,27 +72,8 @@ p tags
|
|
49
72
|
|
50
73
|
rss_feed = ButterCMS::Feed.find(:rss)
|
51
74
|
puts rss_feed.data
|
52
|
-
|
53
|
-
# Content fields
|
54
|
-
content = ButterCMS::Content.fetch([
|
55
|
-
:homepage_html_title,
|
56
|
-
:homepage_meta_description,
|
57
|
-
:homepage_headline
|
58
|
-
])
|
59
|
-
|
60
|
-
# Pages
|
61
|
-
pages = ButterCMS::Page.list('news')
|
62
|
-
|
63
|
-
page = ButterCMS::Page.get('news', 'hello-world')
|
64
75
|
```
|
65
76
|
|
66
|
-
## Localization
|
67
|
-
|
68
|
-
Setup locales in the ButterCMS dashboard and fetch localized content using the `locale` option:
|
69
|
-
|
70
|
-
```ruby
|
71
|
-
ButterCMS::Content.fetch(['landing_pages'], locale: :es)
|
72
|
-
```
|
73
77
|
|
74
78
|
## Fallback Data Store
|
75
79
|
|
@@ -86,14 +90,6 @@ ButterCMS::data_store = :redis, ENV['REDIS_URL']
|
|
86
90
|
ButterCMS::logger = MyLogger.new
|
87
91
|
```
|
88
92
|
|
89
|
-
## Test mode
|
90
|
-
|
91
|
-
Test mode can be used to setup a staging website for previewing content or for testing content during local development. To fetch content from test mode add the following configuration:
|
92
|
-
|
93
|
-
```ruby
|
94
|
-
ButterCMS::test_mode = true
|
95
|
-
```
|
96
|
-
|
97
93
|
### Other
|
98
94
|
|
99
95
|
View Ruby [Blog engine](https://buttercms.com/ruby-blog-engine/) and [Full CMS](https://buttercms.com/ruby-cms/) for other examples of using ButterCMS with Ruby.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.2
|
data/lib/buttercms-ruby.rb
CHANGED
@@ -28,6 +28,7 @@ module ButterCMS
|
|
28
28
|
class << self
|
29
29
|
attr_accessor :api_token
|
30
30
|
attr_accessor :test_mode
|
31
|
+
attr_accessor :read_timeout
|
31
32
|
attr_reader :data_store
|
32
33
|
attr_writer :logger
|
33
34
|
end
|
@@ -72,7 +73,7 @@ module ButterCMS
|
|
72
73
|
|
73
74
|
http_options = {
|
74
75
|
open_timeout: 2.0,
|
75
|
-
read_timeout: 5.0,
|
76
|
+
read_timeout: read_timeout || 5.0,
|
76
77
|
ssl_timeout: 2.0,
|
77
78
|
use_ssl: @api_url.scheme == "https",
|
78
79
|
}
|
data/lib/buttercms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buttercms-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ButterCMS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.6.
|
98
|
+
rubygems_version: 2.6.12
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: A simple Ruby client for the buttercms.com REST API
|