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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1af2d47bc17b54e64a8ba213fde5cc7c40b6f35
4
- data.tar.gz: 8bf8a3f461624bc05bfbf697f8548a463282acf9
3
+ metadata.gz: f21c2f5b3e950742713bdee6d9c8c265a7ae216a
4
+ data.tar.gz: 3af1a2b7c5082658bdeaf281c2d4d6cd27958ca9
5
5
  SHA512:
6
- metadata.gz: 4f7aa47c7b07b5794b083011d0628448d80ae6b77fcb6796ceae0856061ae36f0ff652e32191d850d1297afbc984aefbfd2953a04de23dbd5bb81afd42382414
7
- data.tar.gz: 7747b7ba92d585a6a0c5fdce8b8d9d43012569b0df9d856c70ec0aee21f09c8e3286c42042e70682ead815677c3e2ed249ad962a3868597b6a4d645a01be39b8
6
+ metadata.gz: 31f3c8775ac13a5d8e28556764bd944a70e83a12cae8f75f4d1acdd357b7c3c6a110937b4ddd3ba3436c3fbec754564754230347fee38ed6463a39c5a4ea3da8
7
+ data.tar.gz: 0bcea44ab789a99742de6b4233e98117c1a73686399e00311aeb5bc3b87b3fcbd4bd052244c8e031646b6f0299500ff42d52b070b32662f6a322f7754d672bac
data/CHANGELOG.md CHANGED
@@ -1 +1,5 @@
1
1
  # Changelog
2
+
3
+ ### 2.0.0 - 2017-10-09
4
+ * Enhancement (Breaking change)
5
+ * 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 (1.0.0)
4
+ rexpense (2.0.0)
5
5
  mime-types (~> 2.99)
6
6
  require_all (~> 1.4.0)
7
7
  typhoeus (~> 0.8)
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.api_mode = 'production' # To set the rexpense application that will use
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
@@ -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 user).each do |endpoint|
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, :api_mode, :version
5
+ attr_accessor :user_agent, :url, :version
6
6
 
7
7
  def initialize
8
- @api_mode = 'production'
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
- return PRODUCTION_URL if Rexpense.configuration.api_mode == 'production'
26
- SANDBOX_URL
25
+ Rexpense.configuration.url
27
26
  end
28
27
 
29
28
  def send_request(method, path, options, &block)
@@ -1,3 +1,3 @@
1
1
  module Rexpense
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "2.0.0".freeze
3
3
  end
@@ -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 mode by default" do
8
- expect(subject.api_mode).to eq("production")
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.api_mode = "sandbox"
16
+ subject.url = "http://localhost:3000"
17
17
  subject.user_agent = "My specific user agent"
18
18
 
19
- expect(subject.api_mode).to eq("sandbox")
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
 
@@ -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.api_mode = "sandbox"
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.api_mode).to eq("sandbox")
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
@@ -32,7 +32,7 @@ RSpec.configure do |config|
32
32
  config.mock_with :rspec
33
33
 
34
34
  config.before(:each) do
35
- Rexpense.configuration.api_mode = "sandbox"
35
+ Rexpense.configuration.url = "https://sandbox.rexpense.com"
36
36
  Typhoeus::Expectation.clear
37
37
  end
38
38
  end
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: 1.0.0
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-29 00:00:00.000000000 Z
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.5.1
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