wurfl_cloud_client 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +40 -0
  5. data/Rakefile +19 -0
  6. data/lib/wurfl_cloud.rb +49 -0
  7. data/lib/wurfl_cloud/cache/cookie.rb +43 -0
  8. data/lib/wurfl_cloud/cache/local_memory.rb +43 -0
  9. data/lib/wurfl_cloud/cache/memcached.rb +64 -0
  10. data/lib/wurfl_cloud/cache/null.rb +41 -0
  11. data/lib/wurfl_cloud/cache/rails.rb +56 -0
  12. data/lib/wurfl_cloud/client.rb +105 -0
  13. data/lib/wurfl_cloud/configuration.rb +88 -0
  14. data/lib/wurfl_cloud/device_capabilities.rb +78 -0
  15. data/lib/wurfl_cloud/environment.rb +48 -0
  16. data/lib/wurfl_cloud/errors.rb +23 -0
  17. data/lib/wurfl_cloud/helper.rb +21 -0
  18. data/lib/wurfl_cloud/rack/cache_manager.rb +54 -0
  19. data/lib/wurfl_cloud/rails.rb +34 -0
  20. data/lib/wurfl_cloud/version.rb +14 -0
  21. data/spec/files/generic.json +1 -0
  22. data/spec/files/generic_filtered.json +1 -0
  23. data/spec/files/lumia.json +1 -0
  24. data/spec/files/lumia_filtered.json +1 -0
  25. data/spec/files/strange_values.json +1 -0
  26. data/spec/spec_helper.rb +27 -0
  27. data/spec/support/rack_helpers.rb +79 -0
  28. data/spec/support/string_extensions.rb +33 -0
  29. data/spec/wurfl_cloud/client_spec.rb +207 -0
  30. data/spec/wurfl_cloud/configuration_spec.rb +118 -0
  31. data/spec/wurfl_cloud/cookie_cache_spec.rb +51 -0
  32. data/spec/wurfl_cloud/device_capabilities_spec.rb +143 -0
  33. data/spec/wurfl_cloud/environment_spec.rb +93 -0
  34. data/spec/wurfl_cloud/helper_spec.rb +35 -0
  35. data/spec/wurfl_cloud/memcached_cache_spec.rb +122 -0
  36. data/spec/wurfl_cloud/null_cache_spec.rb +37 -0
  37. data/spec/wurfl_cloud/rack_cache_manager_spec.rb +76 -0
  38. data/spec/wurfl_cloud/rails_cache_spec.rb +126 -0
  39. data/spec/wurfl_cloud/server_request_spec.rb +45 -0
  40. data/wurfl_cloud_client.gemspec +38 -0
  41. metadata +171 -0
@@ -0,0 +1,45 @@
1
+ #
2
+ # Copyright (c) 2015 ScientiaMobile Inc.
3
+ #
4
+ # The WURFL Cloud Client is intended to be used in both open-source and
5
+ # commercial environments. To allow its use in as many situations as possible,
6
+ # the WURFL Cloud Client is dual-licensed. You may choose to use the WURFL
7
+ # Cloud Client under either the GNU GENERAL PUBLIC LICENSE, Version 2.0, or
8
+ # the MIT License.
9
+ #
10
+ # Refer to the COPYING.txt file distributed with this package.
11
+ #
12
+ require 'spec_helper'
13
+
14
+
15
+ describe "the client doing a real request" do
16
+ before(:all) do
17
+ unless defined?(TEST_API_KEY)
18
+ pending(%{ MISSING TEST API KEY
19
+ To be able to execute this test you need to add a file spec/support/test_api_key.rb in which you define the
20
+ constant TEST_API_KEY to hold the api key you'll be using to do the test:
21
+ TEST_API_KEY = '000000:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
22
+ ** DO NOT ADD YOUR KEY TO THE REPOSITORY **
23
+ })
24
+ else
25
+ WurflCloud.configure do |config|
26
+ config.host = 'staging.wurflcloud.com'
27
+ config.api_key = TEST_API_KEY
28
+ end
29
+ @environment = WurflCloud::Environment.new({"HTTP_USER_AGENT"=>%{Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/7D11}})
30
+
31
+ WebMock.allow_net_connect!
32
+ @device = WurflCloud::Client.detect_device(@environment, WurflCloud.configuration.cache(nil))
33
+ end
34
+ end
35
+
36
+ it "should detect the correct device" do
37
+
38
+ @device['id'].should =='apple_iphone_ver4'
39
+ end
40
+
41
+ it "should have the device capabilities" do
42
+ @device['is_wireless_device'].should ==true
43
+ end
44
+
45
+ end
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Copyright (c) 2015 ScientiaMobile Inc.
4
+ #
5
+ # The WURFL Cloud Client is intended to be used in both open-source and
6
+ # commercial environments. To allow its use in as many situations as possible,
7
+ # the WURFL Cloud Client is dual-licensed. You may choose to use the WURFL
8
+ # Cloud Client under either the GNU GENERAL PUBLIC LICENSE, Version 2.0, or
9
+ # the MIT License.
10
+ #
11
+ # Refer to the COPYING.txt file distributed with this package.
12
+ #
13
+ $:.push File.expand_path("../lib", __FILE__)
14
+ require "wurfl_cloud/version"
15
+
16
+ Gem::Specification.new do |s|
17
+ s.name = "wurfl_cloud_client"
18
+ s.version = WurflCloud::VERSION
19
+ s.platform = Gem::Platform::RUBY
20
+ s.authors = ["ScientiaMobile, Inc."]
21
+ s.email = ["support@scientiamobile.com"]
22
+ s.homepage = ""
23
+ s.summary = %q{Wurfl Cound Ruby Client}
24
+ s.description = %q{ruby client for the Wurfl Cloud API}
25
+
26
+ s.rubyforge_project = "wurfl_cloud_client"
27
+
28
+ s.add_dependency "json"
29
+ s.add_dependency "rack"
30
+ s.add_development_dependency "rspec"
31
+ s.add_development_dependency "webmock"
32
+ s.add_development_dependency "simplecov"
33
+
34
+ s.files = `git ls-files`.split("\n")
35
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
36
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
37
+ s.require_paths = ["lib"]
38
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wurfl_cloud_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - ScientiaMobile, Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: ruby client for the Wurfl Cloud API
84
+ email:
85
+ - support@scientiamobile.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - Rakefile
94
+ - lib/wurfl_cloud.rb
95
+ - lib/wurfl_cloud/cache/cookie.rb
96
+ - lib/wurfl_cloud/cache/local_memory.rb
97
+ - lib/wurfl_cloud/cache/memcached.rb
98
+ - lib/wurfl_cloud/cache/null.rb
99
+ - lib/wurfl_cloud/cache/rails.rb
100
+ - lib/wurfl_cloud/client.rb
101
+ - lib/wurfl_cloud/configuration.rb
102
+ - lib/wurfl_cloud/device_capabilities.rb
103
+ - lib/wurfl_cloud/environment.rb
104
+ - lib/wurfl_cloud/errors.rb
105
+ - lib/wurfl_cloud/helper.rb
106
+ - lib/wurfl_cloud/rack/cache_manager.rb
107
+ - lib/wurfl_cloud/rails.rb
108
+ - lib/wurfl_cloud/version.rb
109
+ - spec/files/generic.json
110
+ - spec/files/generic_filtered.json
111
+ - spec/files/lumia.json
112
+ - spec/files/lumia_filtered.json
113
+ - spec/files/strange_values.json
114
+ - spec/spec_helper.rb
115
+ - spec/support/rack_helpers.rb
116
+ - spec/support/string_extensions.rb
117
+ - spec/wurfl_cloud/client_spec.rb
118
+ - spec/wurfl_cloud/configuration_spec.rb
119
+ - spec/wurfl_cloud/cookie_cache_spec.rb
120
+ - spec/wurfl_cloud/device_capabilities_spec.rb
121
+ - spec/wurfl_cloud/environment_spec.rb
122
+ - spec/wurfl_cloud/helper_spec.rb
123
+ - spec/wurfl_cloud/memcached_cache_spec.rb
124
+ - spec/wurfl_cloud/null_cache_spec.rb
125
+ - spec/wurfl_cloud/rack_cache_manager_spec.rb
126
+ - spec/wurfl_cloud/rails_cache_spec.rb
127
+ - spec/wurfl_cloud/server_request_spec.rb
128
+ - wurfl_cloud_client.gemspec
129
+ homepage: ''
130
+ licenses: []
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project: wurfl_cloud_client
148
+ rubygems_version: 2.4.7
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Wurfl Cound Ruby Client
152
+ test_files:
153
+ - spec/files/generic.json
154
+ - spec/files/generic_filtered.json
155
+ - spec/files/lumia.json
156
+ - spec/files/lumia_filtered.json
157
+ - spec/files/strange_values.json
158
+ - spec/spec_helper.rb
159
+ - spec/support/rack_helpers.rb
160
+ - spec/support/string_extensions.rb
161
+ - spec/wurfl_cloud/client_spec.rb
162
+ - spec/wurfl_cloud/configuration_spec.rb
163
+ - spec/wurfl_cloud/cookie_cache_spec.rb
164
+ - spec/wurfl_cloud/device_capabilities_spec.rb
165
+ - spec/wurfl_cloud/environment_spec.rb
166
+ - spec/wurfl_cloud/helper_spec.rb
167
+ - spec/wurfl_cloud/memcached_cache_spec.rb
168
+ - spec/wurfl_cloud/null_cache_spec.rb
169
+ - spec/wurfl_cloud/rack_cache_manager_spec.rb
170
+ - spec/wurfl_cloud/rails_cache_spec.rb
171
+ - spec/wurfl_cloud/server_request_spec.rb