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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 213c4e3b0d9409ef01f566115ee59ac79c1ffd6a
4
- data.tar.gz: 936f410d199bf0bc5f9aa1fa49364f5d10fc9885
3
+ metadata.gz: 8b02b7d0590f7a4ad62bdab1961aa391ed09e4e3
4
+ data.tar.gz: 4fe5e6b47d516f1fad01096afc7888243bde8220
5
5
  SHA512:
6
- metadata.gz: e906ef1e61db4a768425715d96fc0ecc75d39f53d4ea9a0d958cfa1c9a7f2e7ef5b588e047609308c9fbc35af6101b5a925ca3fbc6818909d0bdb6a988a929da
7
- data.tar.gz: 85ec67f19e0dd63aeed49feff44178268e3f67e22d488f298eee027c4e163abadacba75707c18879830f894e50d0ba75cddd6925fbad21718e683a7d604d7406
6
+ metadata.gz: 8abe1ee76e26bb29642a6221947594017fa40405b566820597dd44cd2ca07caf303042e47c94f16f5563d4ef4633fba44a0e0e21dcb3cd0f1a714d1ce9aa9adb
7
+ data.tar.gz: 42371ee5c84d8b8ea342d99e4abb16e6b47eaa8367a98c47eac5b5dd278eded929ba65e6c41cf3583dc34641718d280048ed988f516dc069ff8eaa414b2467ee
data/.gitignore CHANGED
@@ -20,6 +20,7 @@ config/secrets.yml
20
20
  ## Environment normalisation:
21
21
  /.bundle
22
22
  /vendor/bundle
23
+ /vendor/
23
24
 
24
25
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
25
26
  .rvmrc
@@ -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
- # Get the content. If it takes longer than 10 seconds timeout.
53
- response = RestClient.get "#{API_URL}#{path}", {:Authorization => "Token #{get_butter_token}", :timeout => 10}
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
@@ -1,3 +1,3 @@
1
1
  module Buttercms
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -3,7 +3,7 @@ require 'rest-client'
3
3
 
4
4
  module Buttercms
5
5
  class ButtercmsApiTest < ActiveSupport::TestCase
6
- API_URL = 'https://buttercms.com/api/'
6
+ API_URL = 'https://api.buttercms.com/api/'
7
7
  TEST_TOKEN = '6e9f14b48892b00079604c24c7c64a6a987456cf'
8
8
 
9
9
  test "truth" do
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.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-03-11 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json