dimelo_ccp_api 0.4.1 → 0.4.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: 4962e1ddaa81b7ef970c119cbd677c7fc3a59fc1
4
- data.tar.gz: 34a481ab52fcea68f15dce8208b0c77b24ae51f2
3
+ metadata.gz: 8d0e8f60e484353d7ad6eba299f41ae62ab14810
4
+ data.tar.gz: 8d75f69d236b5409a1e48007fa95d0597f63b676
5
5
  SHA512:
6
- metadata.gz: 0ed9b3e676d8ad3f03370e33099b8d93e12f04f6768e49fb067db1689073da37db7deed45f0a9e9fd7af7e3fc4d924bf94baefb1dc479c2349b2a3b337efa233
7
- data.tar.gz: c6db38d30585780a991826a384532b8f89a049ed4c8a5f56cfc507b8034c63f1a61df1aebbc8782fe9efb92a3c0cc92bf4a4366a4931924614eb1bdb8d7698ad
6
+ metadata.gz: 1a4f2ee8939da3f420f967f26915d7d5fcc5f628e26d779a1e5fb26058fba60c8102fbb29ee6d67168f4814bf386bf5efe9af138d513c774f3f37ac77bfcb71b
7
+ data.tar.gz: eda7aa6d80330e16b177424701a4759d807c5e44896306c0ffda312dd1a7359f8fdf0f7d67160df1bd15f585641067f52f598ab173772091915be8233ef6e6c9
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - ruby-head
3
4
  - 2.2
4
5
  - 2.1
5
6
  - 2.0
6
- - ruby-head
7
7
  - jruby-head
8
8
  gemfile:
9
9
  - gemfiles/Gemfile.activesupport-3.2.x
@@ -13,3 +13,4 @@ gemfile:
13
13
  matrix:
14
14
  allow_failures:
15
15
  - gemfile: gemfiles/Gemfile.activesupport-edge
16
+ - rvm: jruby-head
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.4.2
2
+
3
+ Fix created_at edition
4
+ Fix user password/custom_field edition
5
+ Fix avatar_url edition
6
+
1
7
  # 0.3.3
2
8
 
3
9
  Remove warning when attribute is present in api but not defined in model
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Dimelo CCP API [![Build Status](https://travis-ci.org/dimelo/dimelo_ccp_api.svg?branch=master)](https://travis-ci.org/dimelo/dimelo_ccp_api) [![Code Climate](https://codeclimate.com/github/dimelo/dimelo_ccp_api.png)](https://codeclimate.com/github/dimelo/dimelo_ccp_api)
1
+ # Dimelo CCP API [![Build Status](https://travis-ci.org/dimelo/dimelo_ccp_api.svg?branch=master)](https://travis-ci.org/dimelo/dimelo_ccp_api) [![Code Climate](https://codeclimate.com/github/dimelo/dimelo_ccp_api.png)](https://codeclimate.com/github/dimelo/dimelo_ccp_api) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dimelo/dimelo_ccp_api)
2
2
 
3
3
  Ruby client for the Dimelo Customer Community Platform
4
4
 
@@ -28,9 +28,9 @@ gem 'dimelo_ccp_api'
28
28
  require 'dimelo_ccp_api'
29
29
 
30
30
 
31
- users_client = Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimelo.com/1.0', 'access_token' => ENV['DIMELO_CCP_TOKEN'])
32
- answers_client = Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.com/1.0', 'access_token' => ENV['DIMELO_CCP_TOKEN'])
33
- feedbacks_client = Dimelo::CCP::API::Client.new('https://domain-test.api.ideas.dimelo.com/1.0', 'access_token' => ENV['DIMELO_CCP_TOKEN'])
31
+ users_client = Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
32
+ answers_client = Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
33
+ feedbacks_client = Dimelo::CCP::API::Client.new('https://domain-test.api.ideas.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
34
34
 
35
35
  user = Dimelo::CCP::User.find(1, users_client)
36
36
  questions = user.questions(answers_client)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -3,8 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
5
  $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
6
- require 'dimelo_api'
7
- require 'pp'
6
+ require 'dimelo_ccp_api'
8
7
 
9
8
  unless ENV['DIMELO_API_KEY'].present?
10
9
  puts "Don't forget to set your api key"
@@ -16,7 +15,7 @@ users_client = Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimel
16
15
  answers_client = Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
17
16
  feedbacks_client = Dimelo::CCP::API::Client.new('https://domain-test.api.ideas.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
18
17
 
19
- user = Dimelo::API::User.find(1, users_client)
18
+ user = Dimelo::CCP::User.find(1, users_client)
20
19
  questions = user.questions(answers_client)
21
20
  puts "question count: #{questions.count}"
22
21
 
@@ -28,7 +27,7 @@ questions.each do |question, i|
28
27
  end
29
28
  end
30
29
 
31
- feedbacks = Dimelo::API::Feedback.find({ :order => 'updated_at.desc' }, feedbacks_client)
30
+ feedbacks = Dimelo::CCP::Feedback.find({ :order => 'updated_at.desc' }, feedbacks_client)
32
31
  puts "feedbacks count: #{feedbacks.count}"
33
32
  puts "feedbacks not by anonymous and superadmin: #{feedbacks.select{|f| f.user_id.present?}.count}"
34
33
 
@@ -8,7 +8,7 @@ module Dimelo::CCP
8
8
  :attachments_count, :comments_count,
9
9
  :created_at, :updated_at, :question_id, :ipaddr, :question_flow_state
10
10
 
11
- submit_attributes :body, :body_format, :user_id, :question_id
11
+ submit_attributes :body, :body_format, :user_id, :question_id, :created_at
12
12
 
13
13
  belongs_to :user
14
14
  belongs_to :question
@@ -9,7 +9,7 @@ module Dimelo::CCP
9
9
  :closed, :attachments_count, :comments_count, :positive_votes_count, :negative_votes_count,
10
10
  :permalink, :ipaddr, :created_at, :updated_at
11
11
 
12
- submit_attributes :title, :body, :body_format, :category_ids, :user_id
12
+ submit_attributes :title, :body, :body_format, :category_ids, :user_id, :created_at
13
13
 
14
14
  belongs_to :user
15
15
  belongs_to :category
@@ -8,7 +8,7 @@ module Dimelo::CCP
8
8
  path COMMENT_PATH
9
9
 
10
10
  attributes :id, :feedback_id, :body, :body_format, :flow_state, :user_id, :type, :status_id, :attachments_count, :created_at, :updated_at, :permalink, :ipaddr
11
- submit_attributes :body, :body_format, :user_id, :feedback_id, :status_id
11
+ submit_attributes :body, :body_format, :user_id, :feedback_id, :status_id, :created_at
12
12
 
13
13
  belongs_to :user
14
14
  belongs_to :feedback
@@ -3,7 +3,7 @@ module Dimelo::CCP
3
3
 
4
4
  path 'users/%{user_id}/memberships/%{id}'
5
5
 
6
- attributes :id, :user_id, :role, :domain, :domain_application_id
6
+ attributes :id, :user_id, :role, :domain, :domain_application_id, :team
7
7
  submit_attributes :user_id, :role, :domain
8
8
 
9
9
  belongs_to :user
@@ -9,7 +9,7 @@ module Dimelo::CCP
9
9
  :answers_count, :attachments_count, :usefulnesses_yes_count, :usefulnesses_no_count,
10
10
  :star, :closed, :permalink, :created_at, :updated_at
11
11
 
12
- submit_attributes :title, :body, :body_format, :category_ids, :user_id
12
+ submit_attributes :title, :body, :body_format, :category_ids, :user_id, :created_at
13
13
 
14
14
  belongs_to :user
15
15
  belongs_to :category
@@ -3,10 +3,10 @@ module Dimelo::CCP
3
3
  CUSTOM_FIELD_COUNT = 10
4
4
  CUSTOM_FIELD_ATTRIBUTES = (1..CUSTOM_FIELD_COUNT).map { |i| "custom_field_#{i}".to_sym }.freeze
5
5
 
6
- attributes :id, :firstname, :lastname, :signature, :email, :private_message, :type, :username, :flow_state, :about, :avatar, :created_at, :updated_at, :blocked, :team
6
+ attributes :id, :firstname, :lastname, :signature, :email, :private_message, :type, :username, :flow_state, :about, :avatar, :created_at, :updated_at, :blocked, :team, :avatar_url
7
7
  attributes *CUSTOM_FIELD_ATTRIBUTES
8
8
 
9
- submit_attributes :type, :firstname, :lastname, :email, :username, :avatar_url, :about
9
+ submit_attributes :type, :firstname, :lastname, :email, :username, :avatar_url, :about, :password, :created_at, :confirmed_at, *CUSTOM_FIELD_ATTRIBUTES
10
10
 
11
11
  has_many :memberships
12
12
  has_many :questions
@@ -14,7 +14,7 @@ module Dimelo::CCP
14
14
  has_many :feedbacks
15
15
 
16
16
  def avatar_url(size='normal')
17
- avatar.try(:[], size).try(:[], 'url')
17
+ @avatar_url || avatar.try(:[], size).try(:[], 'url')
18
18
  end
19
19
 
20
20
  # Blocks the specified user
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Dimelo::CCP::User do
6
+ describe "#avatar_url" do
7
+ before :each do
8
+ @user = Dimelo::CCP::User.new
9
+ end
10
+ describe "with avatar" do
11
+ before :each do
12
+ @user.avatar = {
13
+ "id" => 1076212,
14
+ "original" => {
15
+ "height" => 960,
16
+ "width" => 640,
17
+ "url" => "http://dimelo.machin.amazonaws.com/identity_avatars/c567/avata.png"
18
+ },
19
+ "small" => {
20
+ "height" => 32,
21
+ "width" => 32,
22
+ "url" => "http://dimelo.machin.amazonaws.com/identity_avatars/c567/avatar_small.png"
23
+ },
24
+ "normal" => {
25
+ "height" => 48,
26
+ "width" => 48,
27
+ "url" => "http://dimelo.machin.amazonaws.com/identity_avatars/c567/avatar_normal.png"
28
+ }
29
+ }
30
+ end
31
+
32
+ describe "with avatar_url" do
33
+ before :each do
34
+ @user.avatar_url = "http://dimelo.machin/other_avatar.png"
35
+ end
36
+
37
+ it "should return avatar_url" do
38
+ expect(@user.avatar_url).to eq("http://dimelo.machin/other_avatar.png")
39
+ end
40
+ end
41
+
42
+ it "should return normal avatar" do
43
+ expect(@user.avatar_url).to eq("http://dimelo.machin.amazonaws.com/identity_avatars/c567/avatar_normal.png")
44
+ end
45
+
46
+ it "should return asked size avatar" do
47
+ expect(@user.avatar_url("small")).to eq("http://dimelo.machin.amazonaws.com/identity_avatars/c567/avatar_small.png")
48
+ end
49
+ end
50
+
51
+ describe "without avatar" do
52
+ describe "with avatar_url" do
53
+ before :each do
54
+ @user.avatar_url = "http://dimelo.machin/other_avatar.png"
55
+ end
56
+
57
+ it "should return avatar_url" do
58
+ expect(@user.avatar_url).to eq("http://dimelo.machin/other_avatar.png")
59
+ end
60
+ end
61
+
62
+ it "should return nil" do
63
+ expect(@user.avatar_url).to eq(nil)
64
+ end
65
+ end
66
+ end
67
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimelo_ccp_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-28 00:00:00.000000000 Z
12
+ date: 2015-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -90,7 +90,6 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
92
  - ".gitignore"
93
- - ".ruby-version"
94
93
  - ".travis.yml"
95
94
  - CHANGELOG.md
96
95
  - Gemfile
@@ -136,6 +135,7 @@ files:
136
135
  - spec/lib/dimelo/ccp/api/model/attachment_spec.rb
137
136
  - spec/lib/dimelo/ccp/api/model/feedback_spec.rb
138
137
  - spec/lib/dimelo/ccp/api/model/question_spec.rb
138
+ - spec/lib/dimelo/ccp/api/model/user_spec.rb
139
139
  - spec/lib/dimelo/ccp/api/model_spec.rb
140
140
  - spec/spec_helper.rb
141
141
  homepage: ''
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project: dimelo_ccp_api
160
- rubygems_version: 2.2.2
160
+ rubygems_version: 2.4.2
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Dimelo CCP v2 API client
@@ -170,5 +170,6 @@ test_files:
170
170
  - spec/lib/dimelo/ccp/api/model/attachment_spec.rb
171
171
  - spec/lib/dimelo/ccp/api/model/feedback_spec.rb
172
172
  - spec/lib/dimelo/ccp/api/model/question_spec.rb
173
+ - spec/lib/dimelo/ccp/api/model/user_spec.rb
173
174
  - spec/lib/dimelo/ccp/api/model_spec.rb
174
175
  - spec/spec_helper.rb
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.1.1