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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a5b25e75cd089178453db6e0bf8998d234dd5c4
4
- data.tar.gz: cf916ea47c139bf2fd8ce739fdac79785d59da6d
3
+ metadata.gz: e1ea15692705af0212338430ea8e62420cac8404
4
+ data.tar.gz: a36d5812d88215de34027b0fdbc01330f58bfb3e
5
5
  SHA512:
6
- metadata.gz: 24878819c0724a9c61c7cf99cab33904c8ccbb1451dd629f10b24e49214d6bc1927ed3d53768efb7a1d3aa9c97314d44fdb4d24efc07c4616608aa482cdcb22b
7
- data.tar.gz: ec48e2d3483619a45cdfac7cc5602e9a2984288539d1fb8e59492b9a6e77d5b1e3f463b8dad536dd2c98017acd3cd316ce41511189a8c8a8c9508eb797ce2191
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', '~>1.0.10'
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.0
1
+ 1.1.1
@@ -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(auth_token: api_token)
74
+ params: options.merge(base_options)
66
75
  },
67
76
  verify_ssl: false
68
77
  )
@@ -1,3 +1,3 @@
1
1
  module ButterCMS
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
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.0
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: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2017-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client