buttercms 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/buttercms/blog_controller.rb +18 -12
- 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: 3fbcd9a81b5d8aa56f7ad78d43997be6266a6fed
|
4
|
+
data.tar.gz: 343e31c30bf786616773637df14816bfe3c78717
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0af019fc2028675d2387825d21e23c81aa9b1f3e43201dba4faa34422e9ed123329cd43527152d4f4192f983f28c162fae403e7e2f4a8d7cea95fe9eb20b0d8b
|
7
|
+
data.tar.gz: 5446438acebaef895a47500eb622de045b73e92a881fa4e98e302cedc31ec55144dd25952560434a47a9ebadd02a911866900f3b01df791838350537866c5cd0
|
@@ -50,21 +50,26 @@ module Buttercms
|
|
50
50
|
def make_butter_request(path)
|
51
51
|
begin
|
52
52
|
# Get the content. If it takes longer than 10 seconds timeout.
|
53
|
-
#
|
54
|
-
response = RestClient.get "
|
53
|
+
# response = RestClient.get "#{API_URL}#{path}", {:Authorization => "Token #{get_butter_token}", :timeout => 10}
|
54
|
+
response = RestClient.get "http://staging.buttercms.com/api/#{path}", {:Authorization => "Token #{get_butter_token}", :timeout => 10}
|
55
55
|
rescue SocketError => e
|
56
56
|
raise Buttercms::ConnectionError
|
57
57
|
rescue => e
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
|
59
|
+
if e.respond_to? :xxxxx
|
60
|
+
case e.response.code
|
61
|
+
when 404
|
62
|
+
butter_not_found
|
63
|
+
when 401
|
64
|
+
raise Buttercms::TokenError
|
65
|
+
else
|
66
|
+
raise Buttercms::InvalidResponseError
|
67
|
+
end
|
68
|
+
else
|
69
|
+
# In the event that e doesn't have a response due to network issue (Errno::ENETUNREACH)
|
70
|
+
raise Buttercms::InvalidResponseError
|
71
|
+
end
|
72
|
+
|
68
73
|
end
|
69
74
|
return response
|
70
75
|
end
|
@@ -99,6 +104,7 @@ module Buttercms
|
|
99
104
|
|
100
105
|
response = make_butter_request("posts/#{page_param}")
|
101
106
|
response_json = JSON.parse(response)
|
107
|
+
p response_json
|
102
108
|
@next_page = response_json['next_page']
|
103
109
|
@previous_page = response_json['previous_page']
|
104
110
|
@recent_posts = response_json['results']
|
data/lib/buttercms/version.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.2
|
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-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|