ruconomic 0.9.3 → 0.9.4

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: d8d6af3d92915cceb4b2a1c0250115aa04975d66
4
- data.tar.gz: 04e85726d81de9bd598658b62ad44ec9cba87318
3
+ metadata.gz: 4fc294bb1382fce4368aa1111b203e58f8838d80
4
+ data.tar.gz: b3da869d5e852e1aaab36024861e8c33559f1b1b
5
5
  SHA512:
6
- metadata.gz: 598073b1bb643cc69b49d0a2bb8dc16c3fa06579229014528b3cabda2152944ccf3d697e2e13b42d94e845ee69ab7a5c626b289b0eb8396fd9d3cee382b1352b
7
- data.tar.gz: dfa3ea917ab897dd598647cabda4380f94401d25675270d054bca615fd62fec7669b80d962281c53e1d14803ce5ce85dd7f5eb75b85fff27514436a5e956fb2c
6
+ metadata.gz: cafa4ba2bcc34c5b74d632e0aabd3110c579b814801a47ea0b459c661bc76015edb519bd51e00fbffde096ce9ed838179465e6d4b962be12339a5a8129952fbb
7
+ data.tar.gz: 2a1a4338d513d334fc50766790d2bac9405e9d568c347d3b1e1cb05a260155d703ed0bb96d276de16217aba9774235e3f5ddb0398a75b205b5796b7d22be5ac3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.4
4
+
5
+ - Added support for token-based login (dinesh)
6
+
3
7
  ## 0.9.3
4
8
 
5
9
  - Added support for X-EconomicAppIdentifier header (dinesh)
data/README.md CHANGED
@@ -36,9 +36,15 @@ Or install it yourself as:
36
36
  require "ruconomic"
37
37
 
38
38
  Ruconomic.configure do |config|
39
+ # to connect with username, password
39
40
  config.agreement = "agreement"
40
41
  config.username = "username"
41
42
  config.password = "password"
43
+
44
+ # or to connect with grant token, app secret token
45
+ config.token = "token"
46
+ config.app_token = "app-token"
47
+
42
48
  # change for your integration but try to keep the format same
43
49
  config.app_identifier = "MyCoolIntegration/1.1 (http://example.com/MyCoolIntegration/; MyCoolIntegration@example.com) Ruconomic/#{Ruconomic::VERSION}"
44
50
  end
data/lib/ruconomic/api.rb CHANGED
@@ -104,15 +104,18 @@ module Ruconomic
104
104
  end
105
105
 
106
106
  # Connects to the server.
107
- # Parameters: token: The access token provided.
107
+ # @params token [String]: The agreement grant token provided
108
+ # Parameters: app_token [String]: The application secret token provided.
108
109
  #
109
- # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
110
110
  # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ConnectWithToken
111
111
  # @return [Hash] The body content of the SOAP response.
112
- def self.connect_with_token
112
+ def self.connect_with_token(token, app_token)
113
113
  response = invoke('ConnectWithToken') do |message|
114
- raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
114
+ message.add 'token', token
115
+ message.add 'appToken', app_token
115
116
  end
117
+
118
+ response.to_hash[:connect_with_token_response][:connect_with_token_result]
116
119
  end
117
120
 
118
121
  # Disconnects from the server.
@@ -1,3 +1,3 @@
1
1
  module Ruconomic
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end
data/lib/ruconomic.rb CHANGED
@@ -8,7 +8,16 @@ module Ruconomic
8
8
  URL = "https://www.e-conomic.com/secure/api1/EconomicWebService.asmx"
9
9
 
10
10
  class << self
11
- attr_accessor :agreement, :username, :password, :timeout, :follow_redirects, :max_redirects, :url, :app_identifier
11
+ attr_accessor :agreement,
12
+ :username,
13
+ :password,
14
+ :timeout,
15
+ :follow_redirects,
16
+ :max_redirects,
17
+ :url,
18
+ :app_identifier,
19
+ :token,
20
+ :app_token
12
21
 
13
22
  def configure &block
14
23
  yield self if block_given?
@@ -31,8 +40,17 @@ module Ruconomic
31
40
  end
32
41
 
33
42
  def session(&block)
34
- raise "Not configured" unless agreement && username && password && url
35
- Ruconomic::API.connect(Ruconomic.agreement, Ruconomic.username, Ruconomic.password)
43
+ with_credential = agreement && username && password && url
44
+ with_token = token && app_token && url
45
+
46
+ if with_credential
47
+ Ruconomic::API.connect(Ruconomic.agreement, Ruconomic.username, Ruconomic.password)
48
+ elsif with_token
49
+ Ruconomic::API.connect_with_token(Ruconomic.token, Ruconomic.app_token)
50
+ else
51
+ raise "Not configured"
52
+ end
53
+
36
54
  yield self::API if block_given?
37
55
  ensure
38
56
  Ruconomic::API.disconnect
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruconomic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tonni Tølbøll Lund Aagesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-04 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.0.14
199
+ rubygems_version: 2.0.14.1
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: Lightweight, speedy and easy-to-use ruby wrapper for the e-conomic.com SOAP