dimelo_ccp_api 0.4.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c588092b15bab07ee5e68f7ca25026c5f5b56b7f00fe2e2e0b5cad05036c572e
4
- data.tar.gz: 5182c9c44a21730c094df50b1bb47a02cc17469bce74d5ec55f15ca19785e156
3
+ metadata.gz: edff5421244502ef947c083c5316c8064757acde55ca3a206a7ff2ef97118983
4
+ data.tar.gz: 301e0b0dac362cdb642e7b32f43515ddb8aa8989e341ea6586a152e1b800a07b
5
5
  SHA512:
6
- metadata.gz: 1b574327b0b7243262714902db490063b4fd86ca9f71710e0384ec1b0fef56ae2a94ac458337137252942cf7a7d7c52f86ab15e02bc47982d7d4d533cdd5d2f3
7
- data.tar.gz: 9c530c919e6b04171edefc8d8747d7bc233a339e00f50d8482c25ad4c0d0aa58eee0859f77b543d9c30862b901b43469bdf364a01c40b0bf6a36ca901001d538
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,7 @@
1
+ # 0.5.0
2
+
3
+ Added compatibility with Active Model 6.1
4
+
1
5
  # 0.4.4
2
6
 
3
7
  Now uses HTTP Authorization Header instead of passing access_token via params.
data/README.md CHANGED
@@ -1,17 +1,19 @@
1
- # RingCentral Engage Communities ruby API Client
1
+ # RingCentral Engage Communities Ruby API Client
2
2
 
3
- Ruby client for the Engage Communities
3
+ [![Build Status](https://github.com/ringcentral/engage-digital-communities-ruby/workflows/Ruby%20CI/badge.svg)](https://github.com/ringcentral/engage-digital-communities-ruby/actions)
4
+
5
+ RubyClient for the Engage Communities.
4
6
 
5
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.
6
8
 
7
- This is heavily used internaly at Engage Communities.
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 MRI 2.4, 2.5, 2.6, Head and Jruby-head
14
- - ActiveSupport 3+, 4+, 5+, Head
15
+ - Ruby MRI 2.6, 2.7, 3.0 and HEAD
16
+ - ActiveSupport 4+, 5+, 6+, Head
15
17
 
16
18
 
17
19
  ## Installation
@@ -47,7 +49,6 @@ 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
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.4
1
+ 0.5.0
@@ -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', '>= 3.0.0')
22
- s.add_dependency('activemodel', '>= 3.0.0')
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
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec :path => '..'
4
4
 
5
- gem 'activesupport', '~> 3.2'
5
+ gem 'activesupport', '~> 4.2'
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec :path => '..'
4
4
 
5
- gem 'activesupport', '~> 4.0'
5
+ gem 'activesupport', '~> 5.2'
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec :path => '..'
4
4
 
5
- gem 'activesupport', '~> 4.1'
5
+ gem 'activesupport', '~> 6.0.0'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem 'activesupport', '~> 6.1.0'
@@ -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.info:4433/1.0', 'access_token' => ENV['DIMELO_API_KEY'], :http_options => {:timeout => 80})
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.info:4433/1.0', :http_options => {:timeout => 80})
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)
@@ -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.info/1.0', 'access_token' => 'foo') }
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
 
@@ -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.4
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: 2020-09-01 00:00:00.000000000 Z
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: 3.0.0
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: 3.0.0
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: 3.0.0
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: 3.0.0
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: '0'
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: '0'
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,8 +95,8 @@ executables: []
89
95
  extensions: []
90
96
  extra_rdoc_files: []
91
97
  files:
98
+ - ".github/workflows/ruby.yml"
92
99
  - ".gitignore"
93
- - ".travis.yml"
94
100
  - CHANGELOG.md
95
101
  - Gemfile
96
102
  - LICENSE.txt
@@ -99,9 +105,10 @@ files:
99
105
  - VERSION
100
106
  - dimelo_ccp_api.gemspec
101
107
  - examples/dimelo_api_test
102
- - gemfiles/Gemfile.activesupport-3.2.x
103
- - gemfiles/Gemfile.activesupport-4.0.x
104
- - gemfiles/Gemfile.activesupport-4.1.x
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
105
112
  - gemfiles/Gemfile.activesupport-head
106
113
  - lib/dimelo/ccp/api.rb
107
114
  - lib/dimelo/ccp/api/basic_object.rb
@@ -141,7 +148,7 @@ files:
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,8 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
163
  - !ruby/object:Gem::Version
157
164
  version: '0'
158
165
  requirements: []
159
- rubygems_version: 3.0.6
160
- signing_key:
166
+ rubygems_version: 3.0.0
167
+ signing_key:
161
168
  specification_version: 4
162
169
  summary: Dimelo CCP v2 API client
163
170
  test_files: []
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - ruby-head
4
- - 2.6
5
- - 2.5
6
- - 2.4
7
- - jruby-head
8
- gemfile:
9
- - gemfiles/Gemfile.activesupport-3.2.x
10
- - gemfiles/Gemfile.activesupport-4.2.x
11
- - gemfiles/Gemfile.activesupport-5.2.x
12
- - gemfiles/Gemfile.activesupport-edge
13
- matrix:
14
- allow_failures:
15
- - gemfile: gemfiles/Gemfile.activesupport-edge
16
- - rvm: jruby-head