deviceatlasapi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/deviceatlasapi/controller.rb +1 -1
- data/lib/deviceatlasapi/version.rb +1 -1
- data/lib/deviceatlasapi.rb +24 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDgyMWI1NjA0Y2IyZTFhMjhhYzk4ODhlNjZhZDA1NjQ3ZTkwNDJjOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDIxM2RhYjBkMDFmMTAzYzI5ZjgxNTdhMDQ2Nzc0ODg3ZTVkMDQ4Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjJhYmZmYzJkY2E4OGViMTkxYzhkZTU5M2UyNzQ0ZTM3MGI5ODI0MmIxMmRj
|
10
|
+
YmMwZTg1MzRlZGVlYzU1MDFlZTg5NmI3NzJkMDIyMGQxOTU2YmYwYmE5MTBk
|
11
|
+
MTEyYmU5MTc5NWI2NTNiNmNiOTU4M2I5ZTU2YzNjNGYzNDRjZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Yzc2YWEzOGQwYmQ0YjBlMTE0NTQxYjc5Nzc1ZmNjZDM1ODYyNTYxYzcwZjNj
|
14
|
+
NDY2MTkwZTQ5OWYyYzAxYjhmOTQxYjkxODVlNTI4OWU0ZWMwZTdlZDRhNWZl
|
15
|
+
YzUwMDdlNTdjMjFiZGQzYWRjYmI4ZWE1YWY3NDliNzlkNzJmY2E=
|
data/lib/deviceatlasapi.rb
CHANGED
@@ -9,22 +9,40 @@ module DeviceAtlasApi
|
|
9
9
|
yield self
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
12
|
class Client
|
14
13
|
|
15
|
-
def initialize
|
16
|
-
@user_agent =
|
14
|
+
def initialize request
|
15
|
+
@user_agent = request.env['HTTP_USER_AGENT']
|
16
|
+
@headers = prepare_headers request
|
17
17
|
@cloud_host = 'api.deviceatlascloud.com'
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_device_data
|
21
|
-
|
21
|
+
url = prepare_url
|
22
|
+
HTTParty.get(url, @headers)["properties"]
|
22
23
|
end
|
23
24
|
|
24
25
|
private
|
25
26
|
|
26
|
-
def
|
27
|
-
|
27
|
+
def prepare_headers request
|
28
|
+
{
|
29
|
+
'HTTP_X_PROFILE' => request.env['HTTP_X_PROFILE'],
|
30
|
+
'HTTP_X_WAP_PROFILE' => request.env['HTTP_X_WAP_PROFILE'],
|
31
|
+
'HTTP_X_ATT_DEVICEID' => request.env['HTTP_X_ATT_DEVICEID'],
|
32
|
+
'HTTP_ACCEPT' => request.env['HTTP_ACCEPT'],
|
33
|
+
'HTTP_ACCEPT_LANGUAGE' => request.env['HTTP_ACCEPT_LANGUAGE'],
|
34
|
+
'HTTP_X_DEVICE_USER_AGENT' => request.env['HTTP_X_DEVICE_USER_AGENT'],
|
35
|
+
'HTTP_X_ORIGINAL_USER_AGENT' => request.env['HTTP_X_ORIGINAL_USER_AGENT'],
|
36
|
+
'HTTP_X_OPERAMINI_PHONE_UA' => request.env['HTTP_X_OPERAMINI_PHONE_UA'],
|
37
|
+
'HTTP_X_SKYFIRE_PHONE' => request.env['HTTP_X_SKYFIRE_PHONE'],
|
38
|
+
'HTTP_X_BOLT_PHONE_UA' => request.env['HTTP_X_BOLT_PHONE_UA'],
|
39
|
+
'HTTP_DEVICE_STOCK_UA' => request.env['HTTP_DEVICE_STOCK_UA'],
|
40
|
+
'HTTP_X_UCBROWSER_DEVICE_UA' => request.env['HTTP_X_UCBROWSER_DEVICE_UA'],
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def prepare_url
|
45
|
+
"http://#{@cloud_host}/v1/detect/properties?licencekey=#{ENV['DEVICE_ATLAS_LICENCE_KEY']}&useragent=#{URI.escape(@user_agent)}"
|
28
46
|
end
|
29
47
|
end
|
30
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deviceatlasapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Kimenye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|