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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 327551dc335aae41bf3736ea5a12fe7d408e2e72
4
- data.tar.gz: d2551f50d1cc81b985df40294edcf896ab97c7c7
3
+ metadata.gz: 3fbcd9a81b5d8aa56f7ad78d43997be6266a6fed
4
+ data.tar.gz: 343e31c30bf786616773637df14816bfe3c78717
5
5
  SHA512:
6
- metadata.gz: e86cb5ec8f11b6a96dd53536424e9ff1484d8dd126cd5699f8cd420768ac6efc036be42b989e2d4edc0b194c1d1e5964d2bf96db3aaccb7a8899f304de4fbb7a
7
- data.tar.gz: 9d81a69ca2ce7981d8c97e50473ba7ac4697106e5100dee52730d9e62135f7c8f8ddc793c34539195a4081ed9bb4a50974af7c7ea090d2598926121729c6bb49
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
- # TODO(jlumetta): Make :timeout configurable.
54
- response = RestClient.get "#{API_URL}#{path}", {:Authorization => "Token #{get_butter_token}", :timeout => 10}
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
- puts e.message
59
-
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
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']
@@ -1,3 +1,3 @@
1
1
  module Buttercms
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
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.1
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-02-16 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json