ahub 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed43a6a7acd45efb75df65746c37c7b3fe0c76eb
4
- data.tar.gz: 1a606b81ebfb767e502d560f6f822af8e292e8a6
3
+ metadata.gz: 9e94b19d6a71c1c761abf9422484e2829e1626ce
4
+ data.tar.gz: 4bd48dfe8351b100d5be1d650b7b8e1f9575520f
5
5
  SHA512:
6
- metadata.gz: 7eef9739128b846d5a570acf8d001defecc9a8a539785f3a854745a9aafcfa5d3f7a05fbd99b1a63983127482653d4c976c927076274fb2984cab6bec8cc62b1
7
- data.tar.gz: 0fb5293fcc74b80d52cb8eadf74a613b85d4a99fb5532d1f6777cb8411585fce363704f3c9d85acc3ea88ca736c5b91d558e0dc43b083e328fc1ad2680ca3b8a
6
+ metadata.gz: 23a2946761d77f409e0d59de8a717b9b69039d1dd4436b1fb72fa8e7ff1d2b8502bccb8f090996a838c0d5b7edf14701f8e931f36cffce12abf23860db5df1d4
7
+ data.tar.gz: 47e9685a9a645907e4ea57583cd4b491d4320b6b0404454c8bbaee9a09f1aaa271503d5885a36cede1f54860c59d78e1e879e075716b67d0521c64b221fdb90d
data/.env_example CHANGED
@@ -1,4 +1,3 @@
1
- AHUB_DEFAULT_PASSWORD=password
2
1
  AHUB_ADMIN_USER=answerhub
3
2
  AHUB_ADMIN_PASS=answerhub
4
3
  AHUB_DOMIAN="http://localhost:8888"
data/README.md CHANGED
@@ -6,7 +6,7 @@ Master
6
6
 
7
7
  ## Warning :warning:
8
8
 
9
- Ahub follows [Semantic Version](http://semver.org/). Though gem will pivot as I see fit :smiling_imp:, I'll ensure to bump the major version for breaking changes. At the moment, however, Ahub is best used for data management tasks (like importing [questions](http://docs.answerhubapiv2.apiary.io/#reference/question)/[answers](http://docs.answerhubapiv2.apiary.io/#reference/answer)/[topics](http://docs.answerhubapiv2.apiary.io/#reference/topic)/[users](http://docs.answerhubapiv2.apiary.io/#reference/user)) & exploration of the data ([groups](http://docs.answerhubapiv2.apiary.io/#reference/group)/[spaces](http://docs.answerhubapiv2.apiary.io/#reference/space)) in your environment.
9
+ Ahub will strictly follow [Semantic Version](http://semver.org/)...AFTER version 1.0.0. Until then, the gem will pivot as I see fit :smiling_imp:. At the moment, however, Ahub is best used for data management tasks (like importing [questions](http://docs.answerhubapiv2.apiary.io/#reference/question)/[answers](http://docs.answerhubapiv2.apiary.io/#reference/answer)/[topics](http://docs.answerhubapiv2.apiary.io/#reference/topic)/[users](http://docs.answerhubapiv2.apiary.io/#reference/user)) & exploration of the data ([groups](http://docs.answerhubapiv2.apiary.io/#reference/group)/[spaces](http://docs.answerhubapiv2.apiary.io/#reference/space)) in your environment.
10
10
 
11
11
  In otherwords, please wait until I remove this warning message before rolling it into your production stack. :sweat_smile:
12
12
 
@@ -6,8 +6,7 @@ module Ahub
6
6
  module APIResource
7
7
  extend ActiveSupport::Concern
8
8
 
9
- included do
10
- end
9
+ attr_reader :attributes
11
10
 
12
11
  def update
13
12
  raise NotImplementedError
@@ -18,10 +17,17 @@ module Ahub
18
17
  end
19
18
 
20
19
  def initialize(attrs)
20
+ @attributes = attrs
21
21
  attrs.each_pair do |k,v|
22
- self.instance_variable_set("@#{k.to_s.underscore}", v)
22
+ attribute_name = k.to_s.underscore
23
+
24
+ if instance_variable_get("@#{attribute_name}").nil?
25
+ instance_variable_set("@#{attribute_name}", v)
26
+ end
27
+
28
+ next if respond_to?(k) && k != :id
23
29
 
24
- self.class.send(:define_method, k.to_s.underscore.to_sym) do
30
+ self.class.send(:define_method, attribute_name) do
25
31
  instance_variable_get("@#{__method__}")
26
32
  end
27
33
  end
data/lib/ahub/user.rb CHANGED
@@ -2,14 +2,10 @@ module Ahub
2
2
  class User
3
3
  include Ahub::APIResource
4
4
 
5
- def self.create(username:, email:, password:nil)
5
+ def self.create(username:, email:, password:)
6
6
  url = "#{base_url}.json"
7
7
 
8
- payload = {
9
- email: email,
10
- username: username,
11
- password: password || Ahub::DEFAULT_PASSWORD,
12
- }
8
+ payload = {email: email, username: username, password: password}
13
9
 
14
10
  create_resource(url: url, payload: payload, headers: admin_headers)
15
11
  end
data/lib/ahub/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ahub
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/ahub.rb CHANGED
@@ -17,7 +17,6 @@ module Ahub
17
17
  Dotenv.load ENV['AHUB_ENV_FILE'] if ENV['AHUB_ENV_FILE']
18
18
 
19
19
  DOMAIN = ENV['AHUB_DOMIAN'] || 'http://localhost:8888'
20
- DEFAULT_PASSWORD = ENV['AHUB_DEFAULT_PASSWORD'] || 'password'
21
20
  ADMIN_USER = ENV['AHUB_ADMIN_USER'] || 'answerhub'
22
21
  ADMIN_PASS = ENV['AHUB_ADMIN_PASS'] || 'answerhub'
23
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abel Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-21 00:00:00.000000000 Z
11
+ date: 2015-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client