dimelo_ccp_api 0.4.1 → 0.5.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 +5 -5
- data/.github/workflows/ruby.yml +31 -0
- data/CHANGELOG.md +14 -0
- data/README.md +12 -11
- data/VERSION +1 -1
- data/dimelo_ccp_api.gemspec +4 -4
- data/examples/dimelo_api_test +4 -4
- data/gemfiles/{Gemfile.activesupport-4.1.x → Gemfile.activesupport-4.2.x} +1 -1
- data/gemfiles/{Gemfile.activesupport-3.2.x → Gemfile.activesupport-5.2.x} +1 -1
- data/gemfiles/{Gemfile.activesupport-4.0.x → Gemfile.activesupport-6.0.x} +1 -1
- data/gemfiles/Gemfile.activesupport-6.1.x +5 -0
- data/lib/dimelo/ccp/api/connection.rb +3 -1
- data/lib/dimelo/ccp/api/model/answer.rb +1 -1
- data/lib/dimelo/ccp/api/model/feedback.rb +1 -1
- data/lib/dimelo/ccp/api/model/feedback_comment.rb +1 -1
- data/lib/dimelo/ccp/api/model/membership.rb +1 -1
- data/lib/dimelo/ccp/api/model/question.rb +1 -1
- data/lib/dimelo/ccp/api/model/user.rb +3 -3
- data/lib/dimelo/ccp/api/model.rb +11 -0
- data/spec/lib/dimelo/ccp/api/client_spec.rb +2 -2
- data/spec/lib/dimelo/ccp/api/connection_spec.rb +7 -1
- data/spec/lib/dimelo/ccp/api/model/attachment_spec.rb +1 -1
- data/spec/lib/dimelo/ccp/api/model/user_spec.rb +67 -0
- data/spec/lib/dimelo/ccp/api/model_spec.rb +29 -1
- metadata +27 -31
- data/.ruby-version +0 -1
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: edff5421244502ef947c083c5316c8064757acde55ca3a206a7ff2ef97118983
|
4
|
+
data.tar.gz: 301e0b0dac362cdb642e7b32f43515ddb8aa8989e341ea6586a152e1b800a07b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a598fa477ab3141a3652be66a5f5b4cbe4ca7163b6b01ad4612a5733da38ab76af9718b9377cd599149522a57ca7f1d726a7ba041934ac0c7b0f80089644c059
|
7
|
+
data.tar.gz: b0d4486af28b8a38d75c944d14afa542de4bb73ec73f091db5bf971c6479ee11a225395ed51539f2a0165769edfbd8f1af605b4636b7f7355caef15ad5e4ca2d
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
strategy:
|
7
|
+
fail-fast: false
|
8
|
+
matrix:
|
9
|
+
ruby: ['2.6', '2.7', '3.0', 'ruby-head']
|
10
|
+
gemfile: ['activesupport-4.2.x', 'activesupport-5.2.x', 'activesupport-6.0.x', 'activesupport-6.1.x', 'activesupport-head']
|
11
|
+
exclude:
|
12
|
+
- ruby: 2.6
|
13
|
+
gemfile: activesupport-head
|
14
|
+
- ruby: 2.7
|
15
|
+
gemfile: activesupport-4.2.x
|
16
|
+
- ruby: 3.0
|
17
|
+
gemfile: activesupport-4.2.x
|
18
|
+
- ruby: ruby-head
|
19
|
+
gemfile: activesupport-4.2.x
|
20
|
+
env:
|
21
|
+
BUNDLE_GEMFILE: gemfiles/Gemfile.${{ matrix.gemfile }}
|
22
|
+
name: Ruby ${{ matrix.ruby }} with ${{ matrix.gemfile }}
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
- name: Set up Ruby
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
ruby-version: ${{ matrix.ruby }}
|
29
|
+
bundler-cache: true
|
30
|
+
- name: Run tests
|
31
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# 0.5.0
|
2
|
+
|
3
|
+
Added compatibility with Active Model 6.1
|
4
|
+
|
5
|
+
# 0.4.4
|
6
|
+
|
7
|
+
Now uses HTTP Authorization Header instead of passing access_token via params.
|
8
|
+
|
9
|
+
# 0.4.2
|
10
|
+
|
11
|
+
Fix created_at edition
|
12
|
+
Fix user password/custom_field edition
|
13
|
+
Fix avatar_url edition
|
14
|
+
|
1
15
|
# 0.3.3
|
2
16
|
|
3
17
|
Remove warning when attribute is present in api but not defined in model
|
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# RingCentral Engage Communities Ruby API Client
|
2
2
|
|
3
|
-
Ruby
|
3
|
+
[](https://github.com/ringcentral/engage-digital-communities-ruby/actions)
|
4
4
|
|
5
|
-
|
5
|
+
RubyClient for the Engage Communities.
|
6
6
|
|
7
|
-
This
|
7
|
+
This client support most of Engage Communities resources, can read and write them, paginates with cursor like interface, supports attachments and supports proper validation and error format.
|
8
|
+
|
9
|
+
This is heavily used internally at Engage Communities.
|
8
10
|
|
9
11
|
# Compatibility
|
10
12
|
|
11
13
|
Compatible and tested with:
|
12
14
|
|
13
|
-
- Ruby 2.
|
14
|
-
- ActiveSupport
|
15
|
+
- Ruby MRI 2.6, 2.7, 3.0 and HEAD
|
16
|
+
- ActiveSupport 4+, 5+, 6+, Head
|
15
17
|
|
16
18
|
|
17
19
|
## Installation
|
@@ -28,9 +30,9 @@ gem 'dimelo_ccp_api'
|
|
28
30
|
require 'dimelo_ccp_api'
|
29
31
|
|
30
32
|
|
31
|
-
users_client = Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimelo.com/1.0', 'access_token' => ENV['
|
32
|
-
answers_client = Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.com/1.0', 'access_token' => ENV['
|
33
|
-
feedbacks_client = Dimelo::CCP::API::Client.new('https://domain-test.api.ideas.dimelo.com/1.0', 'access_token' => ENV['
|
33
|
+
users_client = Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
|
34
|
+
answers_client = Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
|
35
|
+
feedbacks_client = Dimelo::CCP::API::Client.new('https://domain-test.api.ideas.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'])
|
34
36
|
|
35
37
|
user = Dimelo::CCP::User.find(1, users_client)
|
36
38
|
questions = user.questions(answers_client)
|
@@ -47,12 +49,11 @@ end
|
|
47
49
|
feedbacks = Dimelo::CCP::Feedback.find({ :order => 'updated_at.desc' }, feedbacks_client)
|
48
50
|
puts "feedbacks count: #{feedbacks.count}"
|
49
51
|
puts "feedbacks not by anonymous and superadmin: #{feedbacks.select{|f| f.user_id.present?}.count}"
|
50
|
-
|
51
52
|
```
|
52
53
|
|
53
54
|
## Contributing
|
54
55
|
|
55
|
-
1. Fork it ( http://github.com/
|
56
|
+
1. Fork it ( http://github.com/ringcentral/engage-digital-communities-ruby/fork )
|
56
57
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
57
58
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
58
59
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/dimelo_ccp_api.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
-
s.add_dependency('activesupport', '>=
|
22
|
-
s.add_dependency('activemodel', '>=
|
23
|
-
s.add_dependency('faraday')
|
21
|
+
s.add_dependency('activesupport', '>= 4.2')
|
22
|
+
s.add_dependency('activemodel', '>= 4.2')
|
23
|
+
s.add_dependency('faraday', '< 2')
|
24
24
|
s.add_development_dependency('rake')
|
25
|
-
s.add_development_dependency('rspec', '~> 3.0')
|
25
|
+
s.add_development_dependency('rspec', '~> 3.0', '< 3.10')
|
26
26
|
end
|
data/examples/dimelo_api_test
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler'
|
5
5
|
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
6
|
-
require '
|
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,8 @@ 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::
|
18
|
+
user = Dimelo::CCP::User.find(1, users_client)
|
19
|
+
puts user.attributes
|
20
20
|
questions = user.questions(answers_client)
|
21
21
|
puts "question count: #{questions.count}"
|
22
22
|
|
@@ -28,7 +28,7 @@ questions.each do |question, i|
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
feedbacks = Dimelo::
|
31
|
+
feedbacks = Dimelo::CCP::Feedback.find({ :order => 'updated_at.desc' }, feedbacks_client)
|
32
32
|
puts "feedbacks count: #{feedbacks.count}"
|
33
33
|
puts "feedbacks not by anonymous and superadmin: #{feedbacks.select{|f| f.user_id.present?}.count}"
|
34
34
|
|
@@ -29,9 +29,11 @@ module Dimelo::CCP
|
|
29
29
|
initialize_client
|
30
30
|
end
|
31
31
|
|
32
|
-
def perform(method, uri, payload={})
|
32
|
+
def perform(method, uri, payload = {})
|
33
|
+
access_token = payload.delete(:access_token)
|
33
34
|
@client.send(method, uri, payload) do |req|
|
34
35
|
req.headers[:accept] = 'application/json'
|
36
|
+
req.headers[:authorization] = "Bearer #{access_token}"
|
35
37
|
req.headers[:user_agent] = user_agent
|
36
38
|
end
|
37
39
|
end
|
@@ -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, :screenname, :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
|
data/lib/dimelo/ccp/api/model.rb
CHANGED
@@ -204,6 +204,17 @@ module Dimelo::CCP
|
|
204
204
|
defined?(Rails) ? Rails.logger.warn(message) : STDERR.puts(message)
|
205
205
|
end
|
206
206
|
|
207
|
+
def read_attribute_for_validation(attr)
|
208
|
+
attributes[attr] || attributes["#{attr}_id"]
|
209
|
+
end
|
210
|
+
|
211
|
+
def self.human_attribute_name(attr, options = {})
|
212
|
+
attr
|
213
|
+
end
|
214
|
+
|
215
|
+
def self.lookup_ancestors
|
216
|
+
[self]
|
217
|
+
end
|
207
218
|
end
|
208
219
|
end
|
209
220
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Dimelo::CCP::API::Client do
|
4
4
|
|
5
5
|
subject do
|
6
|
-
Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimelo.
|
6
|
+
Dimelo::CCP::API::Client.new('https://domain-test.api.users.dimelo.com/1.0', 'access_token' => ENV['DIMELO_API_KEY'], :http_options => {:timeout => 80})
|
7
7
|
end
|
8
8
|
|
9
9
|
def response_error(status, error, message='')
|
@@ -58,7 +58,7 @@ describe Dimelo::CCP::API::Client do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'raise DomainNotFoundError if request on invalid domain' do
|
61
|
-
client = Dimelo::CCP::API::Client.new('https://no-domain.api.users.dimelo.
|
61
|
+
client = Dimelo::CCP::API::Client.new('https://no-domain.api.users.dimelo.com/1.0', :http_options => {:timeout => 80})
|
62
62
|
expect{
|
63
63
|
client.transport(:get, 'check', {'access_token' => 'my-token'})
|
64
64
|
}.to raise_error(Dimelo::CCP::API::DomainNotFoundError)
|
@@ -35,7 +35,7 @@ describe Dimelo::CCP::API::Connection do
|
|
35
35
|
context 'HTTP' do
|
36
36
|
|
37
37
|
subject do
|
38
|
-
Dimelo::CCP::API::Connection.new('www.google.fr')
|
38
|
+
Dimelo::CCP::API::Connection.new('http://www.google.fr')
|
39
39
|
end
|
40
40
|
|
41
41
|
let(:request) { [:get, 'http://www.google.fr/'] }
|
@@ -97,6 +97,12 @@ describe Dimelo::CCP::API::Connection do
|
|
97
97
|
expect(response).to be_success
|
98
98
|
end
|
99
99
|
|
100
|
+
it 'sends access_token in authorization header' do
|
101
|
+
response = subject.perform(:get, 'http://www.google.com', { q: 'hello', access_token: 'token' })
|
102
|
+
expect(response.env[:request_headers][:authorization]).to eq("Bearer token")
|
103
|
+
expect(response).to be_success
|
104
|
+
end
|
105
|
+
|
100
106
|
context 'Custom user_agent with valid ASCII characters' do
|
101
107
|
let!(:custom_user_agent) { "SMCC; I asked and failed" }
|
102
108
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Dimelo::CCP::Attachment do
|
6
|
-
let(:client) { Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.
|
6
|
+
let(:client) { Dimelo::CCP::API::Client.new('https://domain-test.api.answers.dimelo.com/1.0', 'access_token' => 'foo') }
|
7
7
|
|
8
8
|
describe Dimelo::CCP::QuestionAttachment do
|
9
9
|
|
@@ -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
|
@@ -4,7 +4,7 @@ describe Dimelo::CCP::API::Model do
|
|
4
4
|
|
5
5
|
class User < Dimelo::CCP::API::Model
|
6
6
|
path 'groups/%{group_id}/users/%{id}'
|
7
|
-
attributes :id, :firstname, :lastname
|
7
|
+
attributes :id, :firstname, :lastname, :from_user_id
|
8
8
|
end
|
9
9
|
|
10
10
|
class BaseUser < Dimelo::CCP::API::Model
|
@@ -159,4 +159,32 @@ describe Dimelo::CCP::API::Model do
|
|
159
159
|
|
160
160
|
end
|
161
161
|
|
162
|
+
|
163
|
+
describe '.errors' do
|
164
|
+
it 'works with simple attributes' do
|
165
|
+
user = User.parse(%[
|
166
|
+
{
|
167
|
+
"error": "validation_error",
|
168
|
+
"errors" : [ {"attribute": "firstname", "type": "invalid", "message": "Firstname is invalid"} ],
|
169
|
+
"message": "User can't be saved",
|
170
|
+
"status": 422
|
171
|
+
}
|
172
|
+
])
|
173
|
+
|
174
|
+
expect(user.errors.full_messages.to_sentence).to eq("firstname invalid")
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'works with associations' do
|
178
|
+
user = User.parse(%[
|
179
|
+
{
|
180
|
+
"error": "validation_error",
|
181
|
+
"errors" : [ {"attribute": "from_user", "type": "invalid", "message": "From User is invalid"} ],
|
182
|
+
"message": "User can't be saved",
|
183
|
+
"status": 422
|
184
|
+
}
|
185
|
+
])
|
186
|
+
|
187
|
+
expect(user.errors.full_messages.to_sentence).to eq("from_user invalid")
|
188
|
+
end
|
189
|
+
end
|
162
190
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimelo_ccp_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
- Renaud Morvan
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -17,42 +17,42 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '4.2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: '4.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activemodel
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '4.2'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '4.2'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: faraday
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - "<"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '2'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - "<"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '2'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,6 +74,9 @@ dependencies:
|
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '3.0'
|
77
|
+
- - "<"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '3.10'
|
77
80
|
type: :development
|
78
81
|
prerelease: false
|
79
82
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -81,6 +84,9 @@ dependencies:
|
|
81
84
|
- - "~>"
|
82
85
|
- !ruby/object:Gem::Version
|
83
86
|
version: '3.0'
|
87
|
+
- - "<"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.10'
|
84
90
|
description: Rest API client for Dimelo CCP v2 plateform
|
85
91
|
email:
|
86
92
|
- jean.boussier@dimelo.com
|
@@ -89,9 +95,8 @@ executables: []
|
|
89
95
|
extensions: []
|
90
96
|
extra_rdoc_files: []
|
91
97
|
files:
|
98
|
+
- ".github/workflows/ruby.yml"
|
92
99
|
- ".gitignore"
|
93
|
-
- ".ruby-version"
|
94
|
-
- ".travis.yml"
|
95
100
|
- CHANGELOG.md
|
96
101
|
- Gemfile
|
97
102
|
- LICENSE.txt
|
@@ -100,9 +105,10 @@ files:
|
|
100
105
|
- VERSION
|
101
106
|
- dimelo_ccp_api.gemspec
|
102
107
|
- examples/dimelo_api_test
|
103
|
-
- gemfiles/Gemfile.activesupport-
|
104
|
-
- gemfiles/Gemfile.activesupport-
|
105
|
-
- gemfiles/Gemfile.activesupport-
|
108
|
+
- gemfiles/Gemfile.activesupport-4.2.x
|
109
|
+
- gemfiles/Gemfile.activesupport-5.2.x
|
110
|
+
- gemfiles/Gemfile.activesupport-6.0.x
|
111
|
+
- gemfiles/Gemfile.activesupport-6.1.x
|
106
112
|
- gemfiles/Gemfile.activesupport-head
|
107
113
|
- lib/dimelo/ccp/api.rb
|
108
114
|
- lib/dimelo/ccp/api/basic_object.rb
|
@@ -136,12 +142,13 @@ files:
|
|
136
142
|
- spec/lib/dimelo/ccp/api/model/attachment_spec.rb
|
137
143
|
- spec/lib/dimelo/ccp/api/model/feedback_spec.rb
|
138
144
|
- spec/lib/dimelo/ccp/api/model/question_spec.rb
|
145
|
+
- spec/lib/dimelo/ccp/api/model/user_spec.rb
|
139
146
|
- spec/lib/dimelo/ccp/api/model_spec.rb
|
140
147
|
- spec/spec_helper.rb
|
141
148
|
homepage: ''
|
142
149
|
licenses: []
|
143
150
|
metadata: {}
|
144
|
-
post_install_message:
|
151
|
+
post_install_message:
|
145
152
|
rdoc_options: []
|
146
153
|
require_paths:
|
147
154
|
- lib
|
@@ -156,19 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
163
|
- !ruby/object:Gem::Version
|
157
164
|
version: '0'
|
158
165
|
requirements: []
|
159
|
-
|
160
|
-
|
161
|
-
signing_key:
|
166
|
+
rubygems_version: 3.0.0
|
167
|
+
signing_key:
|
162
168
|
specification_version: 4
|
163
169
|
summary: Dimelo CCP v2 API client
|
164
|
-
test_files:
|
165
|
-
- spec/examples/openable_examples.rb
|
166
|
-
- spec/examples/starrable_example.rb
|
167
|
-
- spec/fixtures/files/logo.jpg
|
168
|
-
- spec/lib/dimelo/ccp/api/client_spec.rb
|
169
|
-
- spec/lib/dimelo/ccp/api/connection_spec.rb
|
170
|
-
- spec/lib/dimelo/ccp/api/model/attachment_spec.rb
|
171
|
-
- spec/lib/dimelo/ccp/api/model/feedback_spec.rb
|
172
|
-
- spec/lib/dimelo/ccp/api/model/question_spec.rb
|
173
|
-
- spec/lib/dimelo/ccp/api/model_spec.rb
|
174
|
-
- spec/spec_helper.rb
|
170
|
+
test_files: []
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.1
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.2
|
4
|
-
- 2.1
|
5
|
-
- 2.0
|
6
|
-
- ruby-head
|
7
|
-
- jruby-head
|
8
|
-
gemfile:
|
9
|
-
- gemfiles/Gemfile.activesupport-3.2.x
|
10
|
-
- gemfiles/Gemfile.activesupport-4.0.x
|
11
|
-
- gemfiles/Gemfile.activesupport-4.1.x
|
12
|
-
- gemfiles/Gemfile.activesupport-edge
|
13
|
-
matrix:
|
14
|
-
allow_failures:
|
15
|
-
- gemfile: gemfiles/Gemfile.activesupport-edge
|