buttercms-ruby 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/VERSION +1 -1
- data/lib/buttercms-ruby.rb +11 -2
- data/lib/buttercms/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1ea15692705af0212338430ea8e62420cac8404
|
4
|
+
data.tar.gz: a36d5812d88215de34027b0fdbc01330f58bfb3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 815fc01babd7a73aeac7322e45483dfe3400842aec196f5337b7c9bbe99c8358e684bc0d06dc6d297af928c0773211808de9e7b1439c677ffa887ad1e2d6ac1b
|
7
|
+
data.tar.gz: 26d3414caddc822e387956919af1a8c942b3fd14d85d960ebfc3e6a020daa34a4036590914991ff2b06149d2cd6775628e0eb11502ece6b33ec039da057b7f66
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ To setup your project, follow these steps:
|
|
11
11
|
1. Install using `gem install buttercms-ruby` or by adding to your `Gemfile`:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'buttercms-ruby'
|
14
|
+
gem 'buttercms-ruby'
|
15
15
|
```
|
16
16
|
|
17
17
|
2. Set your API token.
|
@@ -20,6 +20,9 @@ To setup your project, follow these steps:
|
|
20
20
|
require 'buttercms-ruby'
|
21
21
|
|
22
22
|
ButterCMS::api_token = "YourToken"
|
23
|
+
|
24
|
+
# Fetch content from test mode (eg. for your staging website)
|
25
|
+
# ButterCMS::test_mode = true
|
23
26
|
```
|
24
27
|
|
25
28
|
## Quick Start
|
@@ -68,3 +71,11 @@ ButterCMS::data_store = :redis, ENV['REDIS_URL']
|
|
68
71
|
# Set logger (optional)
|
69
72
|
ButterCMS::logger = MyLogger.new
|
70
73
|
```
|
74
|
+
|
75
|
+
## Test mode
|
76
|
+
|
77
|
+
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:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
ButterCMS::test_mode = true
|
81
|
+
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/lib/buttercms-ruby.rb
CHANGED
@@ -25,8 +25,9 @@ end
|
|
25
25
|
module ButterCMS
|
26
26
|
@api_url = 'https://api.buttercms.com/v2'
|
27
27
|
|
28
|
-
class <<self
|
28
|
+
class << self
|
29
29
|
attr_accessor :api_token
|
30
|
+
attr_accessor :test_mode
|
30
31
|
attr_reader :data_store
|
31
32
|
attr_writer :logger
|
32
33
|
end
|
@@ -58,11 +59,19 @@ module ButterCMS
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def self.api_request(path, options = {})
|
62
|
+
base_options = {
|
63
|
+
auth_token: api_token
|
64
|
+
}
|
65
|
+
|
66
|
+
if test_mode
|
67
|
+
base_options[:test] = 1
|
68
|
+
end
|
69
|
+
|
61
70
|
response = RestClient::Request.execute(
|
62
71
|
method: :get,
|
63
72
|
url: @api_url + path,
|
64
73
|
headers: {
|
65
|
-
params: options.merge(
|
74
|
+
params: options.merge(base_options)
|
66
75
|
},
|
67
76
|
verify_ssl: false
|
68
77
|
)
|
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.1.
|
4
|
+
version: 1.1.1
|
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: 2017-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|