buttercms 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/app/controllers/buttercms/blog_controller.rb +13 -10
- data/lib/buttercms/version.rb +1 -1
- data/test/buttercms_test.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: 8b02b7d0590f7a4ad62bdab1961aa391ed09e4e3
|
4
|
+
data.tar.gz: 4fe5e6b47d516f1fad01096afc7888243bde8220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8abe1ee76e26bb29642a6221947594017fa40405b566820597dd44cd2ca07caf303042e47c94f16f5563d4ef4633fba44a0e0e21dcb3cd0f1a714d1ce9aa9adb
|
7
|
+
data.tar.gz: 42371ee5c84d8b8ea342d99e4abb16e6b47eaa8367a98c47eac5b5dd278eded929ba65e6c41cf3583dc34641718d280048ed988f516dc069ff8eaa414b2467ee
|
data/.gitignore
CHANGED
@@ -30,7 +30,7 @@ module Buttercms
|
|
30
30
|
|
31
31
|
# Thin wrapper around RestClient for talking to Butter API
|
32
32
|
module API
|
33
|
-
API_URL = 'https://buttercms.com/api/'
|
33
|
+
API_URL = 'https://api.buttercms.com/api/'
|
34
34
|
|
35
35
|
def butter_not_found
|
36
36
|
raise ActionController::RoutingError.new('Not Found')
|
@@ -49,8 +49,11 @@ module Buttercms
|
|
49
49
|
|
50
50
|
def make_butter_request(path)
|
51
51
|
begin
|
52
|
-
|
53
|
-
|
52
|
+
response = RestClient::Request.execute(
|
53
|
+
method: :get,
|
54
|
+
url: "#{API_URL}#{path}",
|
55
|
+
verify_ssl: false
|
56
|
+
)
|
54
57
|
rescue SocketError => e
|
55
58
|
raise Buttercms::ConnectionError
|
56
59
|
rescue => e
|
@@ -95,9 +98,9 @@ module Buttercms
|
|
95
98
|
def butter_home
|
96
99
|
# Check for pagination
|
97
100
|
if params[:page]
|
98
|
-
page_param = "?page=#{params[:page]}"
|
101
|
+
page_param = "?page=#{params[:page]}&auth_token=#{get_butter_token}"
|
99
102
|
else
|
100
|
-
page_param =
|
103
|
+
page_param = "?auth_token=#{get_butter_token}"
|
101
104
|
end
|
102
105
|
|
103
106
|
response = make_butter_request("posts/#{page_param}")
|
@@ -110,14 +113,14 @@ module Buttercms
|
|
110
113
|
end
|
111
114
|
|
112
115
|
def butter_post
|
113
|
-
response = make_butter_request("posts/#{params[:slug]}")
|
116
|
+
response = make_butter_request("posts/#{params[:slug]}?auth_token=#{get_butter_token}")
|
114
117
|
@post = JSON.parse(response)
|
115
118
|
|
116
119
|
render template: "blog/post"
|
117
120
|
end
|
118
121
|
|
119
122
|
def butter_author
|
120
|
-
response = make_butter_request("authors/#{params[:author_slug]}")
|
123
|
+
response = make_butter_request("authors/#{params[:author_slug]}?auth_token=#{get_butter_token}")
|
121
124
|
response_json = JSON.parse(response)
|
122
125
|
@first_name = response_json['first_name']
|
123
126
|
@last_name = response_json['last_name']
|
@@ -128,7 +131,7 @@ module Buttercms
|
|
128
131
|
end
|
129
132
|
|
130
133
|
def butter_category
|
131
|
-
response = make_butter_request("categories/#{params[:category_slug]}")
|
134
|
+
response = make_butter_request("categories/#{params[:category_slug]}?auth_token=#{get_butter_token}")
|
132
135
|
response_json = JSON.parse(response)
|
133
136
|
@name = response_json['name']
|
134
137
|
@recent_posts = response_json['recent_posts']
|
@@ -138,7 +141,7 @@ module Buttercms
|
|
138
141
|
|
139
142
|
|
140
143
|
def butter_feed
|
141
|
-
response = make_butter_request("posts
|
144
|
+
response = make_butter_request("posts/?auth_token=#{get_butter_token}")
|
142
145
|
response_json = JSON.parse(response)
|
143
146
|
@recent_posts = response_json['results']
|
144
147
|
respond_to do |format|
|
@@ -148,7 +151,7 @@ module Buttercms
|
|
148
151
|
end
|
149
152
|
|
150
153
|
def butter_sitemap
|
151
|
-
response = make_butter_request("sitemap
|
154
|
+
response = make_butter_request("sitemap/?auth_token=#{get_butter_token}")
|
152
155
|
response_json = JSON.parse(response)
|
153
156
|
@recent_posts = response_json
|
154
157
|
end
|
data/lib/buttercms/version.rb
CHANGED
data/test/buttercms_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buttercms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
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
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|