google_maps_apis 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ require_relative './convert'
2
+
3
+ module GoogleMapsApis
4
+
5
+ # Validate value that is accepted by Google Maps.
6
+ module Validator
7
+ module_function
8
+
9
+ # Validate travel mode. The valid value of travel mode are `driving`, `walking`, `bicycling` or `transit`.
10
+ #
11
+ # @param [String, Symbol] mode Travel mode to be validated.
12
+ #
13
+ # @raise ArgumentError The travel mode is invalid.
14
+ #
15
+ # @return [String] Valid travel mode.
16
+ def travel_mode(mode)
17
+ # NOTE(broady): the mode parameter is not validated by the Maps API
18
+ # server. Check here to prevent silent failures.
19
+ unless [:driving, :walking, :bicycling, :transit].include?(mode.to_sym)
20
+ raise ArgumentError, 'Invalid travel mode.'
21
+ end
22
+ mode
23
+ end
24
+
25
+ # Validate route restriction. The valid value of route restriction are `tolls`, `highways` or `ferries`.
26
+ #
27
+ # @param [String, Symbol] avoid Route restriction to be validated.
28
+ #
29
+ # @raise ArgumentError The route restriction is invalid.
30
+ #
31
+ # @return [String] Valid route restriction.
32
+ def avoid(avoid)
33
+ unless [:tolls, :highways, :ferries].include?(avoid.to_sym)
34
+ raise ArgumentError, 'Invalid route restriction.'
35
+ end
36
+ avoid
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,23 @@
1
+ module GoogleMapsApis
2
+ # GoogleMapsApis gem version
3
+ VERSION = '1.0.0'
4
+
5
+ # Current operating system
6
+ # @private
7
+ OS_VERSION = begin
8
+ if RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/
9
+ `ver`.sub(/\s*\[Version\s*/, '/').sub(']', '').strip
10
+ elsif RUBY_PLATFORM =~ /darwin/i
11
+ "Mac OS X/#{`sw_vers -productVersion`}"
12
+ elsif RUBY_PLATFORM == 'java'
13
+ require 'java'
14
+ name = java.lang.System.getProperty('os.name')
15
+ version = java.lang.System.getProperty('os.version')
16
+ "#{name}/#{version}"
17
+ else
18
+ `uname -sr`.sub(' ', '/')
19
+ end
20
+ rescue
21
+ RUBY_PLATFORM
22
+ end
23
+ end
@@ -0,0 +1,56 @@
1
+ # Google Maps Web Service API.
2
+ module GoogleMapsApis
3
+ class << self
4
+
5
+ # Global key.
6
+ # @see Client#key
7
+ # @return [String]
8
+ attr_accessor :key
9
+
10
+ # Global client_id.
11
+ # @see Client#client_id
12
+ # @return [String]
13
+ attr_accessor :client_id
14
+
15
+ # Global client_secret.
16
+ # @see Client#client_secret
17
+ # @return [String]
18
+ attr_accessor :client_secret
19
+
20
+ # Global retry_timeout.
21
+ # @see Client#retry_timeout
22
+ # @return [Integer]
23
+ attr_accessor :retry_timeout
24
+
25
+ # Global queries_per_second.
26
+ # @see Client#queries_per_second
27
+ # @return [Integer]
28
+ attr_accessor :queries_per_second
29
+
30
+ # Global request_options.
31
+ # @see Client#initialize-instance_method
32
+ # @return [Faraday::RequestOptions]
33
+ attr_accessor :request_options
34
+
35
+ # Global ssl_options.
36
+ # @see Client#initialize-instance_method
37
+ # @return [Faraday::SslOptions]
38
+ attr_accessor :ssl_options
39
+
40
+ # Global connection.
41
+ # @see Client#initialize-instance_method
42
+ # @return [Object]
43
+ attr_accessor :connection
44
+
45
+ # Configure global parameters.
46
+ # @yield [config]
47
+ def configure
48
+ yield self
49
+ true
50
+ end
51
+ end
52
+
53
+ require 'google_maps_apis/version'
54
+ require 'google_maps_apis/client'
55
+ require 'google_maps_apis/polyline'
56
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google_maps_apis
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Edward Samuel Pasaribu
8
+ - Ahmed Abdelhamid
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2024-07-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.12'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.12'
28
+ - !ruby/object:Gem::Dependency
29
+ name: faraday
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '2.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '2.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: retriable
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.1'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.1'
56
+ description:
57
+ email:
58
+ - edwardsamuel92@gmail.com
59
+ - eng.a.abdelhamid@outlook.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".github/ruby.yml"
65
+ - ".gitignore"
66
+ - ".rspec"
67
+ - ".ruby-gemset"
68
+ - ".ruby-version"
69
+ - ".yardopts"
70
+ - CHANGELOG.md
71
+ - CODE_OF_CONDUCT.md
72
+ - Gemfile
73
+ - LICENSE
74
+ - README.md
75
+ - Rakefile
76
+ - bin/console
77
+ - google_maps_apis.gemspec
78
+ - lib/google_maps_apis.rb
79
+ - lib/google_maps_apis/client.rb
80
+ - lib/google_maps_apis/convert.rb
81
+ - lib/google_maps_apis/errors.rb
82
+ - lib/google_maps_apis/polyline.rb
83
+ - lib/google_maps_apis/services.rb
84
+ - lib/google_maps_apis/services/directions.rb
85
+ - lib/google_maps_apis/services/distance_matrix.rb
86
+ - lib/google_maps_apis/services/elevation.rb
87
+ - lib/google_maps_apis/services/geocoding.rb
88
+ - lib/google_maps_apis/services/places.rb
89
+ - lib/google_maps_apis/services/roads.rb
90
+ - lib/google_maps_apis/services/time_zone.rb
91
+ - lib/google_maps_apis/url.rb
92
+ - lib/google_maps_apis/validator.rb
93
+ - lib/google_maps_apis/version.rb
94
+ homepage: https://github.com/go-illa/google-maps-services-ruby/tree/stable
95
+ licenses:
96
+ - Apache-2.0
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.6.0
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubygems_version: 3.2.33
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Ruby gem for Google Maps Web Service APIs
117
+ test_files: []