ratsit 0.0.7 → 0.1.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: c0ed7963cc8f9e9489950b505c3f732efade1bf6
4
- data.tar.gz: c939eb7f60e3e9c861dcd07e527ed4400eba00eb
3
+ metadata.gz: fa2364935612d51f748a5196579f37fc443aaba5
4
+ data.tar.gz: e1c025818d987fc17e20a98176e76fc68d2e7452
5
5
  SHA512:
6
- metadata.gz: ab3a1f1d589424474add8c737cecc0b3c3276b8c5df954b79edebb0856cb4a434a05a110f1eef70bb060d383b849c1d1d02350a09b678a46b34ce19321d77f92
7
- data.tar.gz: 8b187dc811f8d5c030b2976ac4295771740a34e8a173cc824ce2620a71c9b70314882bb9db20dedef1900b45cef03832a4de4a6728a6e2ac3349c6c003b83855
6
+ metadata.gz: 5cad69f510881894d41fd8e6e47929107f9b174f9246bc2910548bd2702b4d62336ce32e6b244e2720ce9e6c6b91506bc4dad11e70276a36dcfd2e703e707c96
7
+ data.tar.gz: 6617d772d3105a1a3d59875ec6211984cdf79fab915ce1d64d5bf1211efdd2685d4abb6af3eb5cc4495ae0f84e2656406afb0a88f9e238d758bbffbff52f793c
@@ -14,7 +14,6 @@ require 'ratsit/filter/filter_search_one_person'
14
14
  require 'ratsit/filter/filter_search_persons'
15
15
 
16
16
  require 'ratsit/request/request'
17
- require 'ratsit/request/open_request'
18
17
  require 'ratsit/request/token_request'
19
18
  require 'ratsit/request/request_get_companies'
20
19
  require 'ratsit/request/request_search_one_person'
@@ -32,30 +31,6 @@ module Ratsit
32
31
  return ENV[key_key]
33
32
  end
34
33
 
35
- def Ratsit.OpenPersonSearch(search_term, search_area, filter_instance=nil)
36
- if !filter_instance.nil? && !filter_instance.instance_of?(Ratsit::Filter::PersonFilter)
37
- raise RatsitFilterError, 'Invalid filter given to function'
38
- end
39
- req = Ratsit::Request::OpenRequest.new(Ratsit::Request::OPEN_REQUEST_EPTS[:person], search_term, search_area, filter_instance || Ratsit::Filter::PersonFilter.new())
40
- req.exec()
41
- if req.response_ok
42
- return req.response_body
43
- end
44
- nil
45
- end
46
-
47
- def Ratsit.OpenCompanySearch(search_term, search_area, filter_instance=nil)
48
- if !filter_instance.nil? && !filter_instance.instance_of?(Ratsit::Filter::CompanyFilter)
49
- raise RatsitFilterError, 'Invalid filter given to function'
50
- end
51
- req = Ratsit::Request::OpenRequest.new(Ratsit::Request::OPEN_REQUEST_EPTS[:company], search_term, search_area, filter_instance || Ratsit::Filter::CompanyFilter.new())
52
- req.exec()
53
- if req.response_ok
54
- return req.response_body
55
- end
56
- nil
57
- end
58
-
59
34
  def Ratsit.doTokenRequest(req_class, filter_args)
60
35
  req = req_class.new(filter_args)
61
36
  puts req
@@ -25,7 +25,6 @@ module Ratsit
25
25
 
26
26
  def response
27
27
  if response_ok
28
- puts JSON.dump(@response.body)
29
28
  return @response.body[:get_person_information_package_response][:get_person_information_package_result][:ratsit_response_package][:person_information_package]
30
29
  end
31
30
  raise RatsitError, 'Response not ready'
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Ratsit
3
- VERSION = '0.0.7'
3
+ VERSION = '0.1.0'
4
4
  end
@@ -6,11 +6,11 @@ require 'ratsit/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ratsit"
8
8
  spec.version = Ratsit::VERSION
9
- spec.authors = ["Stefan Nyman"]
10
- spec.email = ["stefan@qoorp.com"]
9
+ spec.authors = ["Stefan Nyman", "Daniel Lundqvist"]
10
+ spec.email = ["stefan@qoorp.com", "daniel@qoorp.com"]
11
11
 
12
12
  spec.summary = "Perform Ratsit searches for persons and companies."
13
- spec.description = "Can search using either the open api endpoints or by using an api key. Search methods: OpenPersonSearch, OpenCompanySearch, SearchCompanies, SearchPersons, SearchOnePerson."
13
+ spec.description = "Can search by using an api key. Search methods: SearchCompanies, SearchPersons, SearchOnePerson. GetPersonInformationPackage"
14
14
  spec.homepage = "http://github.com/qoorp/ratsit"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratsit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Nyman
8
+ - Daniel Lundqvist
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2016-10-17 00:00:00.000000000 Z
12
+ date: 2016-10-18 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -80,11 +81,11 @@ dependencies:
80
81
  - - "~>"
81
82
  - !ruby/object:Gem::Version
82
83
  version: 2.10.0
83
- description: 'Can search using either the open api endpoints or by using an api key.
84
- Search methods: OpenPersonSearch, OpenCompanySearch, SearchCompanies, SearchPersons,
85
- SearchOnePerson.'
84
+ description: 'Can search by using an api key. Search methods: SearchCompanies, SearchPersons,
85
+ SearchOnePerson. GetPersonInformationPackage'
86
86
  email:
87
87
  - stefan@qoorp.com
88
+ - daniel@qoorp.com
88
89
  executables: []
89
90
  extensions: []
90
91
  extra_rdoc_files: []
@@ -109,7 +110,6 @@ files:
109
110
  - lib/ratsit/filter/filter_search_one_person.rb
110
111
  - lib/ratsit/filter/filter_search_persons.rb
111
112
  - lib/ratsit/monkey.rb
112
- - lib/ratsit/request/open_request.rb
113
113
  - lib/ratsit/request/request.rb
114
114
  - lib/ratsit/request/request_get_companies.rb
115
115
  - lib/ratsit/request/request_get_person_information_package.rb
@@ -1,65 +0,0 @@
1
-
2
- require 'faraday'
3
- require 'uri'
4
- require 'json'
5
-
6
- require 'ratsit/errors'
7
- require 'ratsit/request/request'
8
-
9
-
10
- module Ratsit
11
- module Request
12
- OPEN_REQUEST_EPTS = {
13
- :person => 'PersonSearch',
14
- :company => 'CompanySearch'
15
- }
16
- class OpenRequest < Ratsit::Request::RatsitRequest
17
-
18
- def initialize(ept, search_term, search_area, filter_instance)
19
- if !Ratsit::Request::OPEN_REQUEST_EPTS.values.include?(ept)
20
- raise RatsitRequestError, 'Invalid endpoint specified'
21
- end
22
- if !search_term.instance_of?(String) || search_term.length == 0
23
- raise RatsitRequestError, 'Invalid search term'
24
- end
25
- if !search_area.instance_of?(String)
26
- raise RatsitRequestError, 'Invalid search area'
27
- end
28
- @ept = ept
29
- @search_area = search_area
30
- @search_term = search_term
31
- @filter_instance = filter_instance || {}
32
- super()
33
- end
34
-
35
- def exec
36
- uri = URI.parse("http://www.ratsit.se/BC/SearchSimple.aspx/#{@ept}")
37
- conn = Faraday.new(:url => "#{uri.scheme}://#{uri.host}")
38
- @response = conn.post do |req|
39
- req.url uri.request_uri
40
- req.headers['Content-Type'] = 'application/json'
41
- req.body = self.request_body
42
- end
43
- end
44
-
45
- def request_body
46
- {
47
- 'who': @search_term,
48
- 'where': @search_area,
49
- 'filter': @filter_instance.to_json
50
- }.to_json
51
- end
52
-
53
- def response_ok
54
- return false if @response.nil?
55
- @response.status == 200
56
- end
57
-
58
- def response_body
59
- return nil if @response.nil?
60
- @response.body
61
- end
62
-
63
- end
64
- end
65
- end