rexpense 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +4 -4
- data/README.md +1 -1
- data/lib/rexpense/entities/tag.rb +1 -0
- data/lib/rexpense/entities/user.rb +14 -0
- data/lib/rexpense/resources/tag.rb +15 -15
- data/lib/rexpense/version.rb +1 -1
- data/spec/lib/rexpense/entities/tag_collection_spec.rb +5 -0
- data/spec/lib/rexpense/entities/tag_spec.rb +7 -0
- data/spec/lib/rexpense/entities/user_spec.rb +2 -1
- data/spec/lib/rexpense/resources/organization_spec.rb +19 -1
- data/spec/lib/rexpense/resources/{tag_specs.rb → tag_spec.rb} +19 -2
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 55e9deebd7e25be0c9da4e15c3b9c29452f414a7c5b0735cc820e163f99b55bc
|
4
|
+
data.tar.gz: afed1cf1bf3f8bbf3b3ff7adf4521ffb277676c6351cc6f76081a4e6f86f9d56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88027f7ed94044babfba5ace6bbc9bc2f96b3c5d2303b87abb0b420cd052649da3fafbea99737598b563aa0391ecd92d51b7f03710d3c013408f1782bbd5c19f
|
7
|
+
data.tar.gz: 539867a8b331f32ab1f5665e46e065ebe2b5cf757323e3ae64a2fe0df9f1d3af5ad92d25c4640d3d2bd0eee5c0b8743674453252b1c93b66bcd78c29b952ceb0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 2.1.0 - 2018-07-19
|
4
|
+
* Feature
|
5
|
+
* Add missing group information in tag entity object [#2](https://github.com/myfreecomm/rexpense-client-ruby/pull/2)
|
6
|
+
* Add email information to user entity object [#3](https://github.com/myfreecomm/rexpense-client-ruby/pull/3)
|
7
|
+
|
3
8
|
### 2.0.0 - 2017-10-09
|
4
9
|
* Enhancement (Breaking change)
|
5
10
|
* Change how to configure URL of the endpoints [#1](https://github.com/myfreecomm/rexpense-client-ruby/pull/1)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rexpense (2.
|
4
|
+
rexpense (2.1.0)
|
5
5
|
mime-types (~> 2.99)
|
6
6
|
require_all (~> 1.4.0)
|
7
7
|
typhoeus (~> 0.8)
|
@@ -29,9 +29,9 @@ GEM
|
|
29
29
|
diff-lcs (1.3)
|
30
30
|
docile (1.1.5)
|
31
31
|
equalizer (0.0.11)
|
32
|
-
ethon (0.
|
32
|
+
ethon (0.11.0)
|
33
33
|
ffi (>= 1.3.0)
|
34
|
-
ffi (1.9.
|
34
|
+
ffi (1.9.25)
|
35
35
|
ice_nine (0.11.2)
|
36
36
|
json (2.0.3)
|
37
37
|
method_source (0.8.2)
|
@@ -94,4 +94,4 @@ DEPENDENCIES
|
|
94
94
|
webmock (~> 1.9.3)
|
95
95
|
|
96
96
|
BUNDLED WITH
|
97
|
-
1.
|
97
|
+
1.16.3
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A Ruby client for the [Rexpense](http://www.rexpense.com) REST API
|
|
4
4
|
|
5
5
|
[![Gem version](https://badge.fury.io/rb/rexpense.png)](https://rubygems.org/gems/rexpense)
|
6
6
|
[![Build status](https://travis-ci.org/myfreecomm/rexpense-client-ruby.png?branch=master)](https://travis-ci.org/myfreecomm/rexpense-client-ruby)
|
7
|
-
[![Test coverage](https://codeclimate.com/github/myfreecomm/rexpense-client-ruby/badges/coverage.svg)](https://codeclimate.com/github/myfreecomm/
|
7
|
+
[![Test coverage](https://codeclimate.com/github/myfreecomm/rexpense-client-ruby/badges/coverage.svg)](https://codeclimate.com/github/myfreecomm/rexpense-client-ruby)
|
8
8
|
[![Code Climate grade](https://codeclimate.com/github/myfreecomm/rexpense-client-ruby.png)](https://codeclimate.com/github/myfreecomm/rexpense-client-ruby)
|
9
9
|
|
10
10
|
Rexpense API docs: http://developers.rexpense.com
|
@@ -9,6 +9,20 @@ module Rexpense
|
|
9
9
|
attribute :name, String
|
10
10
|
attribute :avatar, Array[Hash]
|
11
11
|
attribute :default_avatar, Boolean
|
12
|
+
attribute :emails, Array[Hash]
|
13
|
+
attribute :email, String, default: lambda { |page, attribute| select_email(page.emails) }
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def self.select_email(emails_list)
|
18
|
+
main_email = nil
|
19
|
+
emails_list.each do |email_data|
|
20
|
+
if email_data['main']
|
21
|
+
main_email = email_data['email']; break
|
22
|
+
end
|
23
|
+
end
|
24
|
+
main_email
|
25
|
+
end
|
12
26
|
end
|
13
27
|
end
|
14
28
|
end
|
@@ -11,11 +11,11 @@ module Rexpense
|
|
11
11
|
# Get organization tags
|
12
12
|
#
|
13
13
|
# [API]
|
14
|
-
# Method: <tt>GET /api/v1/organization/:
|
14
|
+
# Method: <tt>GET /api/v1/organization/:organization_id/tags</tt>
|
15
15
|
#
|
16
16
|
# Documentation: http://developers.rexpense.com/api/tags#index
|
17
|
-
def find_all(
|
18
|
-
http.get(endpoint_base(
|
17
|
+
def find_all(organization_id)
|
18
|
+
http.get(endpoint_base(organization_id)) do |response|
|
19
19
|
Rexpense::Entities::TagCollection.build response
|
20
20
|
end
|
21
21
|
end
|
@@ -24,11 +24,11 @@ module Rexpense
|
|
24
24
|
# Find a organization tag
|
25
25
|
#
|
26
26
|
# [API]
|
27
|
-
# Method: <tt>GET /api/v1/organization/:
|
27
|
+
# Method: <tt>GET /api/v1/organization/:organization_id/tags/:tag_id</tt>
|
28
28
|
#
|
29
29
|
# Documentation: http://developers.rexpense.com/api/tags#show
|
30
|
-
def find(
|
31
|
-
http.get("#{endpoint_base(
|
30
|
+
def find(organization_id, id)
|
31
|
+
http.get("#{endpoint_base(organization_id)}/#{id}") do |response|
|
32
32
|
Rexpense::Entities::Tag.new response.parsed_body
|
33
33
|
end
|
34
34
|
end
|
@@ -37,11 +37,11 @@ module Rexpense
|
|
37
37
|
# Create a organization tag
|
38
38
|
#
|
39
39
|
# [API]
|
40
|
-
# Method: <tt>POST /api/v1/organization/:
|
40
|
+
# Method: <tt>POST /api/v1/organization/:organization_id/tags</tt>
|
41
41
|
#
|
42
42
|
# Documentation: http://developers.rexpense.com/api/tags#create
|
43
|
-
def create(
|
44
|
-
http.post(endpoint_base(
|
43
|
+
def create(organization_id, params={})
|
44
|
+
http.post(endpoint_base(organization_id), body: params) do |response|
|
45
45
|
Rexpense::Entities::Tag.new response.parsed_body
|
46
46
|
end
|
47
47
|
end
|
@@ -50,11 +50,11 @@ module Rexpense
|
|
50
50
|
# Update a organization tag
|
51
51
|
#
|
52
52
|
# [API]
|
53
|
-
# Method: <tt>PUT /api/v1/organization/:
|
53
|
+
# Method: <tt>PUT /api/v1/organization/:organization_id/tags/:id</tt>
|
54
54
|
#
|
55
55
|
# Documentation: http://developers.rexpense.com/api/tags#update
|
56
|
-
def update(
|
57
|
-
http.put("#{endpoint_base(
|
56
|
+
def update(organization_id, id, params={})
|
57
|
+
http.put("#{endpoint_base(organization_id)}/#{id}", body: params) do |response|
|
58
58
|
Rexpense::Entities::Tag.new response.parsed_body
|
59
59
|
end
|
60
60
|
end
|
@@ -63,11 +63,11 @@ module Rexpense
|
|
63
63
|
# Create a organization tag
|
64
64
|
#
|
65
65
|
# [API]
|
66
|
-
# Method: <tt>DELETE /api/v1/organization/:
|
66
|
+
# Method: <tt>DELETE /api/v1/organization/:organization_id/tags/:id</tt>
|
67
67
|
#
|
68
68
|
# Documentation: http://developers.rexpense.com/api/tags#destroy
|
69
|
-
def destroy(
|
70
|
-
http.delete("#{endpoint_base(
|
69
|
+
def destroy(organization_id, id)
|
70
|
+
http.delete("#{endpoint_base(organization_id)}/#{id}") do |response|
|
71
71
|
true
|
72
72
|
end
|
73
73
|
end
|
data/lib/rexpense/version.rb
CHANGED
@@ -126,7 +126,25 @@ describe Rexpense::Resources::Organization, vcr: true do
|
|
126
126
|
|
127
127
|
it 'find a membership in organization' do
|
128
128
|
expect(subject.class).to eq(Rexpense::Entities::Membership)
|
129
|
-
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'sets user informations correctly' do
|
132
|
+
expect(subject.user.attributes).to eq({
|
133
|
+
avatar: [{"style"=>"original", "url"=>"https://s3.amazonaws.com/rexpense-sandbox-uploads/users/64/f3a7eab501d4296ab7573788495933148d753e7e/original/DM-980-147802948420161101-3-81b6ab.png", "width"=>nil, "height"=>nil, "expiration"=>nil}, {"style"=>"medium", "url"=>"https://s3.amazonaws.com/rexpense-sandbox-uploads/users/64/238b1f41ebdf10c2aeacfa92aea857209c823357/medium/DM-980-147802948420161101-3-81b6ab.png", "width"=>nil, "height"=>nil, "expiration"=>nil}, {"style"=>"thumb", "url"=>"https://s3.amazonaws.com/rexpense-sandbox-uploads/users/64/c62a31737b9e2f0d0c2f14cc5449232bcfc0bd95/thumb/DM-980-147802948420161101-3-81b6ab.png", "width"=>nil, "height"=>nil, "expiration"=>nil}, {"style"=>"tiny", "url"=>"https://s3.amazonaws.com/rexpense-sandbox-uploads/users/64/0dc1c022cde836cf4ed00692028dc49fba56641f/tiny/DM-980-147802948420161101-3-81b6ab.png", "width"=>nil, "height"=>nil, "expiration"=>nil}],
|
134
|
+
default_avatar: true, default_currency: 'BRL',
|
135
|
+
email: 'dante.miranda@nexaas.com',
|
136
|
+
emails: [
|
137
|
+
{ "email" => "dante.alighierimds@gmail.com", "main" => false },
|
138
|
+
{ "email" => "dante.miranda@myfreecomm.com.br", "main" => false },
|
139
|
+
{ "email" => "dante.miranda+int@nexaas.com", "main" => false },
|
140
|
+
{ "email" => "dante.miranda+test@nexaas.com", "main" => false },
|
141
|
+
{ "email" => "dante.alg@live.com", "main" => false },
|
142
|
+
{ "email" => "dante.miranda@nexaas.com", "main" => true }
|
143
|
+
],
|
144
|
+
first_name: 'Dante',
|
145
|
+
id: 64, last_name: 'Miranda', mention_name: 'DanteMiranda',
|
146
|
+
name: nil
|
147
|
+
})
|
130
148
|
end
|
131
149
|
end
|
132
150
|
|
@@ -25,9 +25,26 @@ describe Rexpense::Resources::Tag, vcr: true do
|
|
25
25
|
describe '#find' do
|
26
26
|
subject { client.tags.find(35, 64) }
|
27
27
|
|
28
|
-
it "returns a
|
28
|
+
it "returns a tag object" do
|
29
29
|
expect(subject.class).to eq(tag_klass)
|
30
|
-
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns a tag with correct data" do
|
33
|
+
expect(subject.attributes).to eq({
|
34
|
+
name: "updated tag",
|
35
|
+
id: 64, group: nil
|
36
|
+
})
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when a tag has group' do
|
40
|
+
subject { client.tags.find(35, 77) }
|
41
|
+
|
42
|
+
it 'returns tag with group field filled' do
|
43
|
+
expect(subject.attributes).to eq({
|
44
|
+
id: 77, name: 'ônibus',
|
45
|
+
group: 'transporte'
|
46
|
+
})
|
47
|
+
end
|
31
48
|
end
|
32
49
|
end
|
33
50
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexpense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Hertz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -291,6 +291,8 @@ files:
|
|
291
291
|
- spec/lib/rexpense/entities/pre_expense_spec.rb
|
292
292
|
- spec/lib/rexpense/entities/reimbursement_collection_spec.rb
|
293
293
|
- spec/lib/rexpense/entities/reimbursement_spec.rb
|
294
|
+
- spec/lib/rexpense/entities/tag_collection_spec.rb
|
295
|
+
- spec/lib/rexpense/entities/tag_spec.rb
|
294
296
|
- spec/lib/rexpense/entities/user_collection_spec.rb
|
295
297
|
- spec/lib/rexpense/entities/user_spec.rb
|
296
298
|
- spec/lib/rexpense/entities/webhook_collection_spec.rb
|
@@ -304,7 +306,7 @@ files:
|
|
304
306
|
- spec/lib/rexpense/resources/organization_spec.rb
|
305
307
|
- spec/lib/rexpense/resources/pre_expense_spec.rb
|
306
308
|
- spec/lib/rexpense/resources/reimbursement_spec.rb
|
307
|
-
- spec/lib/rexpense/resources/
|
309
|
+
- spec/lib/rexpense/resources/tag_spec.rb
|
308
310
|
- spec/lib/rexpense/resources/webhook_spec.rb
|
309
311
|
- spec/lib/rexpense/response_spec.rb
|
310
312
|
- spec/lib/rexpense_spec.rb
|
@@ -337,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
339
|
version: '0'
|
338
340
|
requirements: []
|
339
341
|
rubyforge_project:
|
340
|
-
rubygems_version: 2.
|
342
|
+
rubygems_version: 2.7.7
|
341
343
|
signing_key:
|
342
344
|
specification_version: 4
|
343
345
|
summary: A Ruby client for the Rexpense REST API
|
@@ -363,6 +365,8 @@ test_files:
|
|
363
365
|
- spec/lib/rexpense/entities/pre_expense_spec.rb
|
364
366
|
- spec/lib/rexpense/entities/reimbursement_collection_spec.rb
|
365
367
|
- spec/lib/rexpense/entities/reimbursement_spec.rb
|
368
|
+
- spec/lib/rexpense/entities/tag_collection_spec.rb
|
369
|
+
- spec/lib/rexpense/entities/tag_spec.rb
|
366
370
|
- spec/lib/rexpense/entities/user_collection_spec.rb
|
367
371
|
- spec/lib/rexpense/entities/user_spec.rb
|
368
372
|
- spec/lib/rexpense/entities/webhook_collection_spec.rb
|
@@ -376,7 +380,7 @@ test_files:
|
|
376
380
|
- spec/lib/rexpense/resources/organization_spec.rb
|
377
381
|
- spec/lib/rexpense/resources/pre_expense_spec.rb
|
378
382
|
- spec/lib/rexpense/resources/reimbursement_spec.rb
|
379
|
-
- spec/lib/rexpense/resources/
|
383
|
+
- spec/lib/rexpense/resources/tag_spec.rb
|
380
384
|
- spec/lib/rexpense/resources/webhook_spec.rb
|
381
385
|
- spec/lib/rexpense/response_spec.rb
|
382
386
|
- spec/lib/rexpense_spec.rb
|