rails_request_parser 0.1.0 → 0.1.1

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: 1c36f63eb64fb6bcdeb9e15e4a16e2798e8ec263
4
- data.tar.gz: 722ec434703f3ff9d133edb5b0636373b9c2b82d
3
+ metadata.gz: bc7a3593d5c2e77b81cfb1be12e2002f984f8aa1
4
+ data.tar.gz: 7d735c35bbd535dd73d59e6b2cbc9493ad1a378a
5
5
  SHA512:
6
- metadata.gz: a8bf8bed4b03dd2bb3c70c01d1b992493c3eb84b0f01f867fe11239ce69cbee0a859d3e1e715c374114b16187b933dfbdd7124c60c002fa9fb97a48ca367d91d
7
- data.tar.gz: dc0f583269a388d30892073f321063ff1a9d6a0c11d35e9dbbad13260c21feb6210e74968ec74914d4ccd4365127f6eb5048f334b638012c3bb59d72b69167dd
6
+ metadata.gz: f33c698a2a77901840511998499ce921d01478fbebb67a5b3fa357a242034cf8be4562a1c28f3ba5f0b8f68265edd3e6592be2fd936423696b901e195d338c63
7
+ data.tar.gz: de2cad4db1c82993880d778a1c31d5f37dbba964f76ef961d193883d48b2a2deb7c26e9df4358c0fc6e3942353e10f8d57a28770cc8918e0ae99e7f1babea778
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
4
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
5
5
 
6
6
  task :default => :spec
@@ -1,10 +1,29 @@
1
- require "rails_request_parser/version"
1
+ # require "rails_request_parser/version"
2
2
  require 'user_agent_parser'
3
3
 
4
- module RailsRequestParser
5
- def self.is_chrome_browser?(request)
4
+ class RailsRequestParser
5
+ def initialize(request)
6
+ @request = request
7
+ end
8
+ def is_chrome_browser?
6
9
  chrome = 'Chrome'.freeze
7
- return UserAgentParser.parse(request.user_agent).family == chrome
10
+ return UserAgentParser.parse(@request.user_agent).family == chrome
11
+ end
12
+ def is_mac_os?
13
+ mac = 'Mac'.freeze
14
+ UserAgentParser.parse(@request.user_agent).os.to_s.include? mac
15
+ end
16
+ def is_windows_os?
17
+ windows = 'Windows'.freeze
18
+ UserAgentParser.parse(@request.user_agent).os.to_s.include? windows
8
19
  end
9
- # Your code goes here...
10
20
  end
21
+
22
+ # firefox_user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0"
23
+ # chrome_user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
24
+ #
25
+ # Request = Struct.new(:user_agent)
26
+ # request = Request.new(chrome_user_agent)
27
+ # puts request
28
+ # request_parser = RailsRequestParser.new(request)
29
+ # puts request_parser.is_chrome_browser?
@@ -1,3 +1,3 @@
1
- module RailsRequestParser
2
- VERSION = "0.1.0"
1
+ class RailsRequestParser
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,3 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_request_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Gesualdo
@@ -86,6 +86,7 @@ files:
86
86
  - lib/rails_request_parser.rb
87
87
  - lib/rails_request_parser/version.rb
88
88
  - rails_request_parser.gemspec
89
+ - tasks/rspec.rake
89
90
  homepage: ''
90
91
  licenses:
91
92
  - MIT