rexpense 1.0.0 → 2.0.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/rexpense/client.rb +1 -1
- data/lib/rexpense/configuration.rb +2 -2
- data/lib/rexpense/http.rb +2 -3
- data/lib/rexpense/version.rb +1 -1
- data/spec/lib/rexpense/configuration_spec.rb +4 -4
- data/spec/lib/rexpense_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f21c2f5b3e950742713bdee6d9c8c265a7ae216a
|
4
|
+
data.tar.gz: 3af1a2b7c5082658bdeaf281c2d4d6cd27958ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31f3c8775ac13a5d8e28556764bd944a70e83a12cae8f75f4d1acdd357b7c3c6a110937b4ddd3ba3436c3fbec754564754230347fee38ed6463a39c5a4ea3da8
|
7
|
+
data.tar.gz: 0bcea44ab789a99742de6b4233e98117c1a73686399e00311aeb5bc3b87b3fcbd4bd052244c8e031646b6f0299500ff42d52b070b32662f6a322f7754d672bac
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Use `Rexpense.configure` to setup your environment:
|
|
33
33
|
require 'rexpense'
|
34
34
|
|
35
35
|
Rexpense.configure do |config|
|
36
|
-
config.
|
36
|
+
config.url = 'https://app.rexpense.com' # URL of the Rexpense
|
37
37
|
config.version = 'v1' # Current API version
|
38
38
|
config.user_agent = 'My App v1.0' # optional, but you should pass a custom user-agent identifying your app
|
39
39
|
end
|
data/lib/rexpense/client.rb
CHANGED
@@ -30,7 +30,7 @@ module Rexpense
|
|
30
30
|
Rexpense::Resources::PreExpense.new(http)
|
31
31
|
end
|
32
32
|
|
33
|
-
%w(organization expense advancement reimbursement tag webhook membership comment
|
33
|
+
%w(organization expense advancement reimbursement tag webhook membership comment).each do |endpoint|
|
34
34
|
define_method(endpoint + 's') do
|
35
35
|
Object.const_get("Rexpense::Resources::#{endpoint.capitalize}").new(http)
|
36
36
|
end
|
@@ -2,10 +2,10 @@ require "base64"
|
|
2
2
|
|
3
3
|
module Rexpense
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :user_agent, :
|
5
|
+
attr_accessor :user_agent, :url, :version
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
@
|
8
|
+
@url = 'https://app.rexpense.com'
|
9
9
|
@version = 'v1'
|
10
10
|
@user_agent = "Rexpense Ruby Client v#{Rexpense::VERSION}"
|
11
11
|
end
|
data/lib/rexpense/http.rb
CHANGED
@@ -10,7 +10,7 @@ module Rexpense
|
|
10
10
|
|
11
11
|
def initialize(token)
|
12
12
|
@token = token
|
13
|
-
@base_url = api_url + "/#{Rexpense.configuration.version}"
|
13
|
+
@base_url = api_url + "/api/#{Rexpense.configuration.version}"
|
14
14
|
end
|
15
15
|
|
16
16
|
%w[get post delete put patch].each do |m|
|
@@ -22,8 +22,7 @@ module Rexpense
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def api_url
|
25
|
-
|
26
|
-
SANDBOX_URL
|
25
|
+
Rexpense.configuration.url
|
27
26
|
end
|
28
27
|
|
29
28
|
def send_request(method, path, options, &block)
|
data/lib/rexpense/version.rb
CHANGED
@@ -4,8 +4,8 @@ require 'spec_helper'
|
|
4
4
|
describe Rexpense::Configuration do
|
5
5
|
subject { Rexpense::Configuration.new }
|
6
6
|
|
7
|
-
it "uses the production
|
8
|
-
expect(subject.
|
7
|
+
it "uses the production url by default" do
|
8
|
+
expect(subject.url).to eq("https://app.rexpense.com")
|
9
9
|
end
|
10
10
|
|
11
11
|
it "uses a default user agent" do
|
@@ -13,10 +13,10 @@ describe Rexpense::Configuration do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'allows setting the configuration parameters' do
|
16
|
-
subject.
|
16
|
+
subject.url = "http://localhost:3000"
|
17
17
|
subject.user_agent = "My specific user agent"
|
18
18
|
|
19
|
-
expect(subject.
|
19
|
+
expect(subject.url).to eq("http://localhost:3000")
|
20
20
|
expect(subject.user_agent).to eq("My specific user agent")
|
21
21
|
end
|
22
22
|
|
data/spec/lib/rexpense_spec.rb
CHANGED
@@ -9,12 +9,12 @@ describe Rexpense do
|
|
9
9
|
it "should be done via block initialization" do
|
10
10
|
Rexpense.configure do |c|
|
11
11
|
c.user_agent = "My App v1.0"
|
12
|
-
c.
|
12
|
+
c.url = "https://sandbox.rexpense.com"
|
13
13
|
c.version = 'v1'
|
14
14
|
end
|
15
15
|
|
16
16
|
expect(Rexpense.configuration.user_agent).to eq("My App v1.0")
|
17
|
-
expect(Rexpense.configuration.
|
17
|
+
expect(Rexpense.configuration.url).to eq("https://sandbox.rexpense.com")
|
18
18
|
expect(Rexpense.configuration.version).to eq("v1")
|
19
19
|
end
|
20
20
|
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
version: 2.0.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: 2017-09
|
12
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -337,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
337
|
version: '0'
|
338
338
|
requirements: []
|
339
339
|
rubyforge_project:
|
340
|
-
rubygems_version: 2.
|
340
|
+
rubygems_version: 2.6.11
|
341
341
|
signing_key:
|
342
342
|
specification_version: 4
|
343
343
|
summary: A Ruby client for the Rexpense REST API
|