ahub 0.1.14 → 0.1.15

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: b11c85492d4dbe8a0a35913bedbd0923981f80e1
4
- data.tar.gz: dcae934db479bb0d7b68f909ca0c69cadba49534
3
+ metadata.gz: 449165080aa0a7a49f1863a0adb6175e3b40f83e
4
+ data.tar.gz: a64ec6193b9e7a5fd9cfce8604aa08c70a78faa3
5
5
  SHA512:
6
- metadata.gz: dac6d749ab6a169a0bb54836aacad9c27fee939b0516c8b919f91b2fe32d8c36e40c255ac2f182cedc88de0c1887306b0a4ed8963a856793f1d4d96dadd72961
7
- data.tar.gz: 41d75ed0904baa303c3db587b13f1f7a9984eaef9afa82120e1e840be5f6cff5866ff646d1418002cc1ccdc35f35d01419f3e6b0c3d2678bd6843f0b17c2e41e
6
+ metadata.gz: 3c7cf47b4fb9019bae3c3a8f70608e7669e5132db1a07bcfbd28926b583efde34efed27e8c211c4b9a4ea4f089928aeda45e2ca01bb310563b99748a6a9b13db
7
+ data.tar.gz: 984e3c9ec063cc4d5c685dceb93bfe433a207fe8b890e1a1ab2e84353b2b513cffe822c910e28e99977499a1a05ac4b89481b73fa346cf124d92e630f1611aad
data/lib/ahub/answer.rb CHANGED
@@ -4,11 +4,9 @@ module Ahub
4
4
  include Ahub::ClassHelpers
5
5
 
6
6
  def self.create(question_id:, body:, username:, password:)
7
- payload = {body: body}
8
-
9
7
  url = "#{Ahub::DOMAIN}/services/v2/question/#{question_id}/answer.json"
10
8
 
11
- make_post_call(url, payload.to_json, headers(username: username, password: password))
9
+ make_post_call(url, {body: body}, headers(username: username, password: password))
12
10
  end
13
11
 
14
12
  attr_reader :body, :body_as_html, :author
@@ -48,7 +48,7 @@ module Ahub
48
48
  private
49
49
 
50
50
  def make_post_call(url:, payload:, headers:)
51
- response = RestClient.post(url, payload.to_json, admin_headers)
51
+ response = RestClient.post(url, payload.to_json, headers)
52
52
  find(object_id_from_response(response))
53
53
  end
54
54
  end
data/lib/ahub/question.rb CHANGED
@@ -3,19 +3,20 @@ module Ahub
3
3
  extend Ahub::APIHelpers
4
4
  include Ahub::ClassHelpers
5
5
 
6
- attr_accessor :title, :body, :body_as_html, :author
7
- attr_reader :space_id, :answerCount
8
-
9
6
  def self.create(title:, body:, topics:, space_id: nil, username:, password:)
10
7
  url = "#{base_url}.json"
8
+
11
9
  payload = {title: title, body: body, topics: topics}
12
10
  payload[:spaceId] = space_id if space_id
13
11
 
14
12
  user_headers = headers(username:username, password:password)
15
13
 
16
- make_post_call(url: url, payload: payload.to_json, headers: user_headers)
14
+ make_post_call(url: url, payload: payload, headers: user_headers)
17
15
  end
18
16
 
17
+ attr_accessor :title, :body, :body_as_html, :author
18
+ attr_reader :space_id, :answerCount
19
+
19
20
  def initialize(attrs)
20
21
  @answer_ids = attrs[:answers]
21
22
  @answerCount = attrs[:answerCount]
data/lib/ahub/user.rb CHANGED
@@ -12,7 +12,7 @@ module Ahub
12
12
  password: password || Ahub::DEFAULT_PASSWORD,
13
13
  }
14
14
 
15
- response = RestClient.post(url, payload.to_json, admin_headers)
15
+ response = RestClient.post(url, payload, admin_headers)
16
16
  find(object_id_from_response(response))
17
17
  end
18
18
 
data/lib/ahub/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ahub
2
- VERSION = "0.1.14"
2
+ VERSION = "0.1.15"
3
3
  end
data/lib/ahub.rb CHANGED
@@ -3,7 +3,6 @@ require 'rest_client'
3
3
  require 'ahub/modules/api_helpers'
4
4
  require 'ahub/modules/class_helpers'
5
5
  require 'ahub/version'
6
- require 'ahub/exception_factory'
7
6
  require 'ahub/user'
8
7
  require 'ahub/question'
9
8
  require 'ahub/answer'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abel Martin
@@ -118,7 +118,6 @@ files:
118
118
  - bin/setup
119
119
  - lib/ahub.rb
120
120
  - lib/ahub/answer.rb
121
- - lib/ahub/exception_factory.rb
122
121
  - lib/ahub/group.rb
123
122
  - lib/ahub/modules/api_helpers.rb
124
123
  - lib/ahub/modules/class_helpers.rb
@@ -1,15 +0,0 @@
1
- module Ahub
2
- class ExceptionFactory
3
- attr_reader :orignal_exception
4
- def initialize(exception)
5
- new UnknownError(exception)
6
-
7
- @orignal_exception = exception
8
- end
9
- end
10
-
11
- class RequestError < Exception ; end
12
- class RedirectError < Exception ; end
13
- class LicenseError < Exception ; end
14
- class UnknownError < Exception ; end
15
- end