rconomic 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a313ca9c76fdc8960400e6fcadaf28ec6f95cc9d2a384ad23e10dac7f5fa437
4
- data.tar.gz: 9978cf2741e44bbfb27b2a0bae8897cc47ea145a266eb5d5efb2a59473ac8fb4
3
+ metadata.gz: 2f1a219e94882985de0e54c405e83d38f41f143fb15aaea9d411aa1b1c48acf9
4
+ data.tar.gz: beafac33256aad1ad07d84f1c5e3695c29020748adf85ab9f6e06896d648549e
5
5
  SHA512:
6
- metadata.gz: 5f37f47e568b52d750b902461e32710046cb607b65c2f239dc6a2429f9591d2d9db910211fedaae68818772b7955c62416155ff02dd9356e5c06ad347f2fe4c3
7
- data.tar.gz: b401ccbdcd48c1e4b901b716a9d953bc7176dd58e1aacb6a14a72a263c3a5de63e305b8728df2e1ba1c011732d3dd08d98a8246652a64f8926a890af9b5e00f2
6
+ metadata.gz: 7ba0dedca0390d08d94ccba9996b8189e48f48c099ea98aad37c2d1e287a1ef44a291257e5c988cb1c6bb8700fba56c161b4c9e7e5e624484efde73b32def53a
7
+ data.tar.gz: 7ada580604da2cf3a9fbe8a4d64febd2e1df680adb9976a7511cf3b56cba02abe484e523a17d5cac5c116f650b47c687d6f43e45500d9fb76b95d04ccff3df70
data/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [Unreleased]
7
+
8
+ ### Added
9
+
10
+ *
11
+
12
+ ### Changes
13
+
14
+ *
15
+
16
+ ### Removed
17
+
18
+ ## 0.7.0 [July 1st, 2018]
19
+
20
+ This release contains breaking changes as E-conomic has deprecated one of their connection methods. See https://www.e-conomic.com/developer#_ga=2.79896535.1117342868.1530474675-2146547048.1526554784 for details.
21
+
22
+ ### Removed
23
+
24
+ * Ability to connect with agreement number, username and password. You need to use `Economic::Session#connect_with_token` going forward.
25
+ * Ability to set an app identifier. This was tied to the now removed `Economic::Session#connect_with_credentials` method.
26
+
6
27
  ## 0.6.1 [July 1st, 2018]
7
28
 
8
29
  ### Changes
data/README.md CHANGED
@@ -13,11 +13,7 @@ Usage example
13
13
 
14
14
  economic = Economic::Session.new
15
15
 
16
- # After 16 November 2015, you must supply an 'Application ID' with #connect_with_credentials
17
- # As described here: http://techtalk.e-conomic.com/e-conomic-soap-api-now-requires-you-to-specify-a-custom-x-economicappidentifier-header/
18
- economic.connect_with_credentials(123456, 'API', 'passw0rd', 'my awesome integration v1.0.0')
19
-
20
- # Or connect using a Private app ID and an access ID provided by the "Grant Access"
16
+ # Connect using a Private app ID and an access ID provided by the "Grant Access"
21
17
  # As described here: http://www.e-conomic.com/developer/tutorials
22
18
  economic = Economic::Session.new
23
19
  economic.connect_with_token 'the_private_app_id', 'the_access_id_you_got_from_the_grant'
@@ -96,10 +92,10 @@ Usage example
96
92
  How to enable e-conomic API access
97
93
  ----------------------------------
98
94
 
99
- You need to enable API access in e-conomic before you can, well, use the API. Otherwise you'll be getting access denied errors when connecting.
100
-
101
- Just follow the instructions on [e-copedia](http://wiki.e-conomic.co.uk/add-on-modules/) to enable the API Add-on module.
95
+ You need a Developer account and setup an app in their web UI. E-conomic users can then grant that app access to their account.
102
96
 
97
+ * Developer portal: https://www.e-conomic.com/developer
98
+ * Instructions: https://www.e-conomic.com/developer/connect
103
99
 
104
100
  It doesn't do everything
105
101
  ------------------------
@@ -11,13 +11,7 @@ class Economic::Endpoint
11
11
  # Create a new Endpoint
12
12
  #
13
13
  # Economic::Session uses this internally
14
- #
15
- # ==== Attributes
16
- #
17
- # * +app_identifier+ - A string identifiying your application, as described in http://techtalk.e-conomic.com/e-conomic-soap-api-now-requires-you-to-specify-a-custom-x-economicappidentifier-header/
18
- #
19
- def initialize(app_identifier = nil)
20
- @app_identifier = app_identifier
14
+ def initialize
21
15
  end
22
16
 
23
17
  # Invokes soap_action on the API endpoint with the given data.
@@ -48,9 +42,6 @@ class Economic::Endpoint
48
42
  def client(force_new_instance: false)
49
43
  reset_client if force_new_instance
50
44
  options = client_options
51
- if @app_identifier
52
- options[:headers] = {"X-EconomicAppIdentifier" => @app_identifier}
53
- end
54
45
  @@client ||= Savon.client(options)
55
46
  end
56
47
 
@@ -8,14 +8,9 @@ module Economic
8
8
 
9
9
  def_delegators :endpoint, :logger=, :log_level=, :log=
10
10
 
11
- attr_accessor :agreement_number, :user_name, :password, :app_identifier
12
11
  attr_reader :authentication_cookies
13
12
 
14
- def initialize(agreement_number = nil, user_name = nil, password = nil, app_identifier = nil)
15
- self.agreement_number = agreement_number
16
- self.user_name = user_name
17
- self.password = password
18
- self.app_identifier = app_identifier
13
+ def initialize
19
14
  yield endpoint if block_given?
20
15
  end
21
16
 
@@ -38,34 +33,6 @@ module Economic
38
33
  end
39
34
  end
40
35
 
41
- # Connect/authenticate with credentials
42
- #
43
- # ==== Attributes
44
- #
45
- # * +agreement_number+ - your economic agreement number
46
- # * +user_name+ - your username
47
- # * +password+ - your passsword
48
- # * +app_identifier+ - A string identifiying your application, as described in http://techtalk.e-conomic.com/e-conomic-soap-api-now-requires-you-to-specify-a-custom-x-economicappidentifier-header/
49
- #
50
- def connect_with_credentials(agreement_number, user_name, password, app_identifier = nil)
51
- self.app_identifier = app_identifier if app_identifier
52
-
53
- endpoint.call(
54
- :connect,
55
- :agreementNumber => agreement_number,
56
- :userName => user_name,
57
- :password => password
58
- ) do |response|
59
- store_authentication_cookies(response)
60
- end
61
- end
62
-
63
- # Authenticates with E-conomic using credentials
64
- # Assumes ::new was called with credentials as arguments.
65
- def connect
66
- connect_with_credentials(agreement_number, user_name, password, app_identifier)
67
- end
68
-
69
36
  # Provides access to the DebtorContacts
70
37
  def contacts
71
38
  @contacts ||= DebtorContactProxy.new(self)
@@ -142,7 +109,7 @@ module Economic
142
109
 
143
110
  # Returns the SOAP endpoint to connect to
144
111
  def endpoint
145
- @endpoint ||= Economic::Endpoint.new(app_identifier)
112
+ @endpoint ||= Economic::Endpoint.new
146
113
  end
147
114
 
148
115
  private
data/lib/rconomic.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # Dependencies
2
2
  require "time"
3
3
  require "savon"
4
- require "savon_ext/request"
5
4
 
6
5
  require "economic/support/string"
7
6
  require "economic/session"
@@ -1,3 +1,3 @@
1
1
  module Rconomic
2
- VERSION = "0.6.1".freeze
2
+ VERSION = "0.7.0".freeze
3
3
  end
data/rconomic.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.version = Rconomic::VERSION
18
18
  s.platform = Gem::Platform::RUBY
19
19
 
20
- s.add_runtime_dependency "savon", "~> 2.2", "< 2.11.2"
20
+ s.add_runtime_dependency "savon", "~> 2.2"
21
21
  s.add_development_dependency "rspec", "> 3.0"
22
22
 
23
23
  s.files = `git ls-files`.split("\n").reject { |filename| [".gitignore"].include?(filename) }
@@ -86,20 +86,4 @@ describe Economic::Endpoint do
86
86
  subject.logger = logger
87
87
  end
88
88
  end
89
-
90
- describe "app identifier configuration" do
91
- let(:app_id) { "my awesome app v.4.0.9-beta-rc1" }
92
-
93
- subject {
94
- described_class.new(app_id)
95
- }
96
-
97
- it "adds the app identifier HTTP headers" do
98
- client = subject.client(:force_new_instance => true)
99
- globals = client.globals
100
- expect(
101
- globals[:headers]["X-EconomicAppIdentifier"]
102
- ).to eq(app_id)
103
- end
104
- end
105
89
  end
@@ -1,99 +1,20 @@
1
1
  require "./spec/spec_helper"
2
2
 
3
3
  describe Economic::Session do
4
- let(:credentials) { [123_456, "api", "passw0rd"] }
5
4
  subject { Economic::Session.new }
6
5
 
7
6
  let(:endpoint) { subject.endpoint }
8
7
 
9
8
  describe "new" do
10
- describe "legacy connect" do
11
- subject { Economic::Session.new(*credentials) }
12
- it "should store authentication details" do
13
- expect(subject.agreement_number).to eq(123_456)
14
- expect(subject.user_name).to eq("api")
15
- expect(subject.password).to eq("passw0rd")
16
- end
17
-
18
- it "can also store an app_id" do
19
- session = Economic::Session.new(*credentials, "app_id")
20
- expect(session.app_identifier).to eq("app_id")
21
- end
22
- end
23
-
24
9
  it "yields the endpoint if a block is given" do
25
10
  endpoint_mock = double("Endpoint")
26
11
  allow(Economic::Endpoint).to receive(:new).and_return(endpoint_mock)
27
12
  expect {|b|
28
- Economic::Session.new(123_456, "api", "passw0rd", &b)
13
+ Economic::Session.new(&b)
29
14
  }.to yield_with_args(endpoint_mock)
30
15
  end
31
16
  end
32
17
 
33
- describe "connect" do
34
- let(:authentication_details) {
35
- {
36
- :agreementNumber => 123_456,
37
- :userName => "api",
38
- :password => "passw0rd"
39
- }
40
- }
41
-
42
- it "can connect old-style" do
43
- mock_request(:connect, authentication_details, :success)
44
- e = Economic::Session.new(*credentials)
45
- e.connect
46
- end
47
-
48
- it "connects to e-conomic with authentication details" do
49
- mock_request(:connect, authentication_details, :success)
50
- subject.connect_with_credentials(*credentials)
51
- end
52
-
53
- it "stores the authentication token for later requests" do
54
- response = {
55
- :headers => {"Set-Cookie" => "cookie value from e-conomic"},
56
- :body => fixture(:connect, :success)
57
- }
58
- stub_request("Connect", authentication_details, response)
59
-
60
- subject.connect_with_credentials(*credentials)
61
-
62
- expect(subject.authentication_cookies.collect { |cookie|
63
- cookie.name_and_value.split("=").last
64
- }).to eq(["cookie value from e-conomic"])
65
- end
66
-
67
- it "updates the authentication token for new sessions" do
68
- stub_request(
69
- "Connect",
70
- nil,
71
- :headers => {"Set-Cookie" => "authentication token"}
72
- )
73
- subject.connect_with_credentials(*credentials)
74
-
75
- stub_request(
76
- "Connect",
77
- nil,
78
- :headers => {"Set-Cookie" => "another token"}
79
- )
80
- other_session = Economic::Session.new
81
- other_session.connect_with_credentials(123_456, "api", "passw0rd")
82
-
83
- expect(subject.authentication_cookies.collect { |cookie|
84
- cookie.name_and_value.split("=").last
85
- }).to eq(["authentication token"])
86
- expect(other_session.authentication_cookies.collect { |cookie|
87
- cookie.name_and_value.split("=").last
88
- }).to eq(["another token"])
89
- end
90
-
91
- it "doesn't use existing authentication details when connecting" do
92
- expect(endpoint).to receive(:call).with(:connect, instance_of(Hash))
93
- subject.connect_with_credentials(*credentials)
94
- end
95
- end
96
-
97
18
  describe "connecting with access ID" do
98
19
  # As per http://www.e-conomic.com/developer/tutorials
99
20
  let(:authentication_details) {
@@ -124,30 +45,6 @@ describe Economic::Session do
124
45
  }).to eq(["cookie value from e-conomic"])
125
46
  end
126
47
 
127
- it "updates the authentication token for new sessions" do
128
- stub_request(
129
- "ConnectWithToken",
130
- nil,
131
- :headers => {"Set-Cookie" => "authentication token"}
132
- )
133
- subject.connect_with_token private_app_id, access_id
134
-
135
- stub_request(
136
- "Connect",
137
- nil,
138
- :headers => {"Set-Cookie" => "another token"}
139
- )
140
- other_session = Economic::Session.new
141
- other_session.connect_with_credentials(123_456, "api", "passw0rd")
142
-
143
- expect(subject.authentication_cookies.collect { |cookie|
144
- cookie.name_and_value.split("=").last
145
- }).to eq(["authentication token"])
146
- expect(other_session.authentication_cookies.collect { |cookie|
147
- cookie.name_and_value.split("=").last
148
- }).to eq(["another token"])
149
- end
150
-
151
48
  it "doesn't use existing authentication details when connecting" do
152
49
  expect(endpoint).to receive(:call).with(
153
50
  :connect_with_token,
@@ -61,5 +61,5 @@ def make_debtor(properties = {})
61
61
  end
62
62
 
63
63
  def make_session
64
- Economic::Session.new(123_456, "api", "passw0rd")
64
+ Economic::Session.new
65
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rconomic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Skjerning
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 2.11.2
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '2.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 2.11.2
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rspec
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -111,7 +105,6 @@ files:
111
105
  - lib/economic/support/string.rb
112
106
  - lib/rconomic.rb
113
107
  - lib/rconomic/version.rb
114
- - lib/savon_ext/request.rb
115
108
  - rconomic.gemspec
116
109
  - spec/economic/account_spec.rb
117
110
  - spec/economic/cash_book_entry_spec.rb
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Savon
4
- class SOAPRequest < HTTPRequest
5
- def build(options = {})
6
- configure_proxy
7
- configure_timeouts
8
- configure_headers options[:soap_action]
9
- configure_cookies options[:cookies]
10
- configure_ssl
11
- configure_auth
12
- configure_redirect_handling
13
-
14
- @http_request
15
- end
16
- end
17
- end