onlia 0.1.5 → 0.1.7
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/.travis.yml +1 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +16 -16
- data/lib/onlia/client.rb +15 -6
- data/lib/onlia/version.rb +1 -1
- data/onlia.gemspec +15 -15
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e43580fecba6be4224187c980315eafc252ba6fe9b155b485554ab2acca0c47
|
4
|
+
data.tar.gz: 7efd11378bd0410673075039776a84a00305469698789faa3ef26c1968f60e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94312e1406c7c8af5cb7746cb000c0ead3bec0ad9e4c11b504c827859030a694219e8fde83abf4a7d98605a44b449eeb858de4e7d046245f67a04c6a54e8370e
|
7
|
+
data.tar.gz: 645abf55787ebea1719cb9c4faf76ce2c54c376505ecf7668b987eb94fb59330980a85fd2b3bace601d95dfc8822fd38e0caea962d4d40230097541f441c9437
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
onlia (0.1.
|
4
|
+
onlia (0.1.7)
|
5
5
|
jwt (~> 2.2.2)
|
6
6
|
rest-client (>= 2.1.0)
|
7
7
|
|
@@ -19,30 +19,30 @@ GEM
|
|
19
19
|
method_source (1.0.0)
|
20
20
|
mime-types (3.4.1)
|
21
21
|
mime-types-data (~> 3.2015)
|
22
|
-
mime-types-data (3.
|
22
|
+
mime-types-data (3.2023.0218.1)
|
23
23
|
netrc (0.11.0)
|
24
24
|
pry (0.14.1)
|
25
25
|
coderay (~> 1.1)
|
26
26
|
method_source (~> 1.0)
|
27
|
-
rake (
|
27
|
+
rake (13.0.6)
|
28
28
|
rest-client (2.1.0)
|
29
29
|
http-accept (>= 1.7.0, < 2.0)
|
30
30
|
http-cookie (>= 1.0.2, < 2.0)
|
31
31
|
mime-types (>= 1.16, < 4.0)
|
32
32
|
netrc (~> 0.8)
|
33
|
-
rspec (3.
|
34
|
-
rspec-core (~> 3.
|
35
|
-
rspec-expectations (~> 3.
|
36
|
-
rspec-mocks (~> 3.
|
37
|
-
rspec-core (3.
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-expectations (3.
|
33
|
+
rspec (3.12.0)
|
34
|
+
rspec-core (~> 3.12.0)
|
35
|
+
rspec-expectations (~> 3.12.0)
|
36
|
+
rspec-mocks (~> 3.12.0)
|
37
|
+
rspec-core (3.12.1)
|
38
|
+
rspec-support (~> 3.12.0)
|
39
|
+
rspec-expectations (3.12.2)
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.
|
42
|
-
rspec-mocks (3.
|
41
|
+
rspec-support (~> 3.12.0)
|
42
|
+
rspec-mocks (3.12.3)
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-support (3.
|
44
|
+
rspec-support (~> 3.12.0)
|
45
|
+
rspec-support (3.12.0)
|
46
46
|
unf (0.1.4)
|
47
47
|
unf_ext
|
48
48
|
unf_ext (0.0.8.2)
|
@@ -53,8 +53,8 @@ PLATFORMS
|
|
53
53
|
DEPENDENCIES
|
54
54
|
onlia!
|
55
55
|
pry
|
56
|
-
rake (~>
|
57
|
-
rspec (~> 3.0)
|
56
|
+
rake (~> 13.0)
|
57
|
+
rspec (~> 3.12.0)
|
58
58
|
|
59
59
|
BUNDLED WITH
|
60
60
|
2.2.26
|
data/lib/onlia/client.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "rest-client"
|
2
|
+
require "json"
|
3
|
+
require "jwt"
|
4
4
|
|
5
5
|
module Onlia
|
6
6
|
class Client
|
7
7
|
class ResponseError < StandardError; end
|
8
|
+
|
8
9
|
attr_accessor :api_token, :raw_token, :decoded_token
|
9
10
|
|
10
11
|
def initialize
|
@@ -33,7 +34,15 @@ module Onlia
|
|
33
34
|
headers["Authorization"] = "Bearer #{token}" if !token.nil?
|
34
35
|
begin
|
35
36
|
response = RestClient::Request.execute(method: :post, url: endpoint_url, payload: body.to_json, headers: headers)
|
36
|
-
|
37
|
+
if endpoint === "/Auto/activate"
|
38
|
+
if response&.body&.include?("%PDF")
|
39
|
+
response.body
|
40
|
+
else
|
41
|
+
JSON.parse(response.body)
|
42
|
+
end
|
43
|
+
else
|
44
|
+
JSON.parse(response.body)
|
45
|
+
end
|
37
46
|
rescue RestClient::ExceptionWithResponse => exception
|
38
47
|
JSON.parse(exception.response.body)
|
39
48
|
rescue JSON::ParserError => exception
|
@@ -44,9 +53,9 @@ module Onlia
|
|
44
53
|
end
|
45
54
|
|
46
55
|
def get_token
|
47
|
-
request_body = {"apiKey": Onlia.configuration.api_key}
|
56
|
+
request_body = { "apiKey": Onlia.configuration.api_key }
|
48
57
|
post("/login", request_body)
|
49
|
-
|
58
|
+
end
|
50
59
|
|
51
60
|
def get_quote(params)
|
52
61
|
post("/Auto/quote", params, @api_token)
|
data/lib/onlia/version.rb
CHANGED
data/onlia.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "lib/onlia/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name
|
5
|
-
spec.version
|
6
|
-
spec.authors
|
7
|
-
spec.email
|
4
|
+
spec.name = "onlia"
|
5
|
+
spec.version = Onlia::VERSION
|
6
|
+
spec.authors = ["Manpreet"]
|
7
|
+
spec.email = ["manpreet@metawarelabs.com"]
|
8
8
|
|
9
|
-
spec.summary
|
10
|
-
spec.description
|
11
|
-
spec.homepage
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
9
|
+
spec.summary = %q{Onlia is a Ruby gem that provides a simple interface to the Onlia API.}
|
10
|
+
spec.description = %q{Onlia is a Ruby gem that provides a simple interface to the Onlia API. It allows you to request quote from Onlia API.}
|
11
|
+
spec.homepage = "https://roam.auto"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.2")
|
13
13
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/metaware/onlia"
|
@@ -17,15 +17,15 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files
|
20
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
21
21
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
22
|
end
|
23
|
-
spec.bindir
|
24
|
-
spec.executables
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_development_dependency(
|
27
|
+
spec.add_development_dependency("pry")
|
28
28
|
|
29
|
-
spec.add_dependency(
|
30
|
-
spec.add_dependency(
|
29
|
+
spec.add_dependency("rest-client", ">= 2.1.0")
|
30
|
+
spec.add_dependency("jwt", "~> 2.2.2")
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manpreet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -88,15 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
89
89
|
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 2.
|
91
|
+
version: 2.7.2
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.7.10
|
98
|
+
rubygems_version: 3.1.6
|
100
99
|
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: Onlia is a Ruby gem that provides a simple interface to the Onlia API.
|