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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04e5948b85acb5cd2d872cfeb3e3b2501dd7d67ffd969c56f028b3372c8cfaee
4
- data.tar.gz: 5477d634c309ea903508382a876ab7666d29e3263a34cd85ace1bfd6517605f0
3
+ metadata.gz: 9e43580fecba6be4224187c980315eafc252ba6fe9b155b485554ab2acca0c47
4
+ data.tar.gz: 7efd11378bd0410673075039776a84a00305469698789faa3ef26c1968f60e8b
5
5
  SHA512:
6
- metadata.gz: 48be415c23221724609bc717d45e642c506e57ed84cccb3c76e5b88c7ca5c05bf4197e086f8bcd98f76130bb776117a7c85ebe4203285a02b4fe7de6b027624e
7
- data.tar.gz: 28d18f17561ab7ede7738c7a1c92486421bd3932d9f8e563b7213451d6eb8805fb7d00d0733ce9d83f6f63683e88994ad3a61958044c796b11b0b4fa3af854ce
6
+ metadata.gz: 94312e1406c7c8af5cb7746cb000c0ead3bec0ad9e4c11b504c827859030a694219e8fde83abf4a7d98605a44b449eeb858de4e7d046245f67a04c6a54e8370e
7
+ data.tar.gz: 645abf55787ebea1719cb9c4faf76ce2c54c376505ecf7668b987eb94fb59330980a85fd2b3bace601d95dfc8822fd38e0caea962d4d40230097541f441c9437
data/.travis.yml CHANGED
@@ -3,4 +3,4 @@ language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
5
  - 2.4.0
6
- before_install: gem install bundler -v 2.1.4
6
+ before_install: gem install bundler -v 2.4.6
data/Gemfile CHANGED
@@ -3,5 +3,5 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in onlia.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
6
+ gem "rake", "~> 13.0"
7
+ gem "rspec", "~> 3.12.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- onlia (0.1.5)
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.2022.0105)
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 (12.3.3)
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.11.0)
34
- rspec-core (~> 3.11.0)
35
- rspec-expectations (~> 3.11.0)
36
- rspec-mocks (~> 3.11.0)
37
- rspec-core (3.11.0)
38
- rspec-support (~> 3.11.0)
39
- rspec-expectations (3.11.1)
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.11.0)
42
- rspec-mocks (3.11.1)
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.11.0)
45
- rspec-support (3.11.1)
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 (~> 12.0)
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 'rest-client'
2
- require 'json'
3
- require 'jwt'
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
- JSON.parse(response.body)
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
- end
58
+ end
50
59
 
51
60
  def get_quote(params)
52
61
  post("/Auto/quote", params, @api_token)
data/lib/onlia/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Onlia
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
data/onlia.gemspec CHANGED
@@ -1,15 +1,15 @@
1
- require_relative 'lib/onlia/version'
1
+ require_relative "lib/onlia/version"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = "onlia"
5
- spec.version = Onlia::VERSION
6
- spec.authors = ["Manpreet"]
7
- spec.email = ["manpreet@metawarelabs.com"]
4
+ spec.name = "onlia"
5
+ spec.version = Onlia::VERSION
6
+ spec.authors = ["Manpreet"]
7
+ spec.email = ["manpreet@metawarelabs.com"]
8
8
 
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.5.0")
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 = Dir.chdir(File.expand_path('..', __FILE__)) do
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 = "exe"
24
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
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('pry')
27
+ spec.add_development_dependency("pry")
28
28
 
29
- spec.add_dependency('rest-client', '>= 2.1.0')
30
- spec.add_dependency('jwt', '~> 2.2.2')
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.5
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: 2022-10-31 00:00:00.000000000 Z
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.5.0
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
- rubyforge_project:
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.