conversocial 0.1.3 → 0.1.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: d6acff9c25ab3aae6a2020405a44fe7364825cca
4
- data.tar.gz: c0ced2ec48afb4b8394e33db7107d3eb052cbcbd
3
+ metadata.gz: 8764b923129b5d400e5aa0fda70f321660c46100
4
+ data.tar.gz: fab16fd618f3267f956a35752092083afb3e86e4
5
5
  SHA512:
6
- metadata.gz: 92c07dd7fefbb1d7eb6caa83dcbb9a981f9464cb5e43071ba368a09f6fcb57a5e9b730e1252c0e9718344feb2172c5b1f768a5ff7a9c35ef8a6801430c488762
7
- data.tar.gz: 89022683324da89ad5b30804ca3e70705bb97ab54b9ffd3516d1229e902686329c47bdc11a1c8b0a1f773eafbf00e1af8930aa4a434a5d4a69aaba4254612f59
6
+ metadata.gz: 1e97309bf37932c6d4b7b73ee71b68c382338aae5b3935c988eaab5b582f6a81691c59c666c519c70a65e1a71bf31e1c13c0ac98eb997f8358b8b4b3afe39a93
7
+ data.tar.gz: a62e2194d8fcf1a4c9b75e4c3a781f80132b9ad5faf4f95ed4209ff1ecb86f66f35e5023cd99ba6569b87d303365e8aa0b54494ca586f20a332d46bb9f53e61c
@@ -0,0 +1,8 @@
1
+ module Conversocial
2
+ module Resources
3
+ module Exceptions
4
+ class PermissionsError < Base
5
+ end
6
+ end
7
+ end
8
+ end
@@ -64,7 +64,6 @@ module Conversocial
64
64
  end
65
65
 
66
66
  def find find_id
67
-
68
67
  @query_params[:fields] ||= model_klass.fields.join(',')
69
68
 
70
69
  json = get_json add_query_params("/#{find_id}", default_find_query_params.merge(@query_params))
@@ -73,7 +72,6 @@ module Conversocial
73
72
  item = new json[resource_name]
74
73
  attach_content_to_items([item], json['content']).first
75
74
  end
76
-
77
75
  end
78
76
 
79
77
  def size
@@ -208,11 +206,19 @@ module Conversocial
208
206
 
209
207
  json = JSON.parse response.body
210
208
  if response.kind_of? Net::HTTPSuccess
209
+ if json.keys.include?('success') && !json['success']
210
+ if json.keys.include?('permsError') && !!json['permsError']
211
+ raise Conversocial::Resources::Exceptions::PermissionsError.new response.code, response.message, (json['error'] || json['message'])
212
+ else
213
+ raise Conversocial::Resources::Exceptions::Base.new response.code, response.message, json['message']
214
+ end
215
+ else
216
+ json
217
+ end
211
218
  json
212
219
  else
213
220
  if 404 == response.code.to_i
214
221
  if json['message'] == "No such #{resource_name}"
215
- #puts "returning nil here"
216
222
  return nil
217
223
  end
218
224
  end
@@ -1,3 +1,3 @@
1
1
  module Conversocial
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/conversocial.rb CHANGED
@@ -35,6 +35,7 @@ require 'conversocial/resources/query_engines/user'
35
35
  #require exceptions
36
36
  require 'conversocial/resources/exceptions/base'
37
37
  require 'conversocial/resources/exceptions/rate_limit_exceeded'
38
+ require 'conversocial/resources/exceptions/permissions_error'
38
39
 
39
40
  module Conversocial
40
41
  # Your code goes here...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conversocial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -55,6 +55,7 @@ files:
55
55
  - lib/conversocial/client.rb
56
56
  - lib/conversocial/resources.rb
57
57
  - lib/conversocial/resources/exceptions/base.rb
58
+ - lib/conversocial/resources/exceptions/permissions_error.rb
58
59
  - lib/conversocial/resources/exceptions/rate_limit_exceeded.rb
59
60
  - lib/conversocial/resources/models.rb
60
61
  - lib/conversocial/resources/models/account.rb