namaz 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -4
- data/lib/namaz.rb +12 -12
- data/lib/namaz/version.rb +1 -1
- data/namaz.gemspec +5 -0
- metadata +58 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 307e0c3bb43668c6b4b94ae8da31bf5f50ab1f1c
|
4
|
+
data.tar.gz: aef40096f162d0cd1a7ec0d4fc841c601f1bfd85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b2c2f99665a1033fe02b061b0e5abe76f0755272bee92550a0af0a20e4417a9fa9917510e38308bdca1921f8c17a9d5eaf10484bfa80791344a76aecb8ce521
|
7
|
+
data.tar.gz: fb8cc3ef5b26c008ef6c4201c6d976203b57b8089438f4064faaf101159c0ac667efca1470717bc46fcf1fb2c04fe3ffca4076a8402f586a73dc9ef218df034a
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ You can then make requests to the following method.
|
|
36
36
|
## Using Altitudes:
|
37
37
|
Namaz.timings(latitude:, longitude:, timezonestring:, method:, options: {})
|
38
38
|
## Using City and Country Information:
|
39
|
-
Namaz.
|
39
|
+
Namaz.timings_by_city(city:, country:, method:, options: {})
|
40
40
|
```
|
41
41
|
|
42
42
|
### Examples:
|
@@ -44,7 +44,7 @@ Namaz.timings(city:, country:, method:, options: {})
|
|
44
44
|
# Using Altitudes:
|
45
45
|
Namaz.timings(latitude: 31.5546, longitude: 74.3572, timezonestring: "Asia/Karachi", method: 1, options: {timestamp: Time.now.to_i})
|
46
46
|
# Using City and Country Information:
|
47
|
-
Namaz.
|
47
|
+
Namaz.timings_by_city(city: 'Karachi', country: 'PK', method: 1, options: {timestamp: Time.now.to_i})
|
48
48
|
```
|
49
49
|
|
50
50
|
##### Example Request Using Altitudes
|
@@ -55,7 +55,7 @@ timings = Namaz.timings(latitude: 31.5546, longitude: 74.3572, timezonestring: "
|
|
55
55
|
##### Example Request Using Country and City Information
|
56
56
|
|
57
57
|
```ruby
|
58
|
-
timings = Namaz.
|
58
|
+
timings = Namaz.timings_by_city(city: 'Karachi', country: 'PK', method: 1, options: {state: 'Punjab', timestamp: Time.now.to_i})
|
59
59
|
```
|
60
60
|
##### Example Response
|
61
61
|
|
@@ -112,6 +112,24 @@ Namaz.connection = Faraday.new do |builder|
|
|
112
112
|
end
|
113
113
|
```
|
114
114
|
|
115
|
+
## CHANGE LOG:
|
116
|
+
|
117
|
+
* **0.1.0:** Request Using Altitudes
|
118
|
+
* **0.1.1:** Added new request Using Country and City Information
|
119
|
+
* **0.1.2:** Updated method name for Timings information for city from `timings` to `timings_by_city`
|
120
|
+
|
121
|
+
**TODO:**
|
122
|
+
Follow the link https://aladhan.com/prayer-times-api and add patch by creating a Pull Rquest, I will merge and publish new version
|
123
|
+
|
124
|
+
* Calendar
|
125
|
+
* Current Time Stamp
|
126
|
+
* Current Time
|
127
|
+
* City Geolocation Info
|
128
|
+
* Address Geolocation Info
|
129
|
+
* Calendar by City
|
130
|
+
* Timings by Address
|
131
|
+
* Calendar by Address
|
132
|
+
|
115
133
|
## License
|
116
134
|
|
117
135
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -128,4 +146,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
128
146
|
|
129
147
|
## Contributing
|
130
148
|
|
131
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
149
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Sohair63/namaz. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/namaz.rb
CHANGED
@@ -10,10 +10,10 @@ module Namaz
|
|
10
10
|
class << self
|
11
11
|
# Retrieve the namaz timings for a given latitude, longitude, timezonestring and method.
|
12
12
|
#
|
13
|
-
# @param
|
14
|
-
# @param
|
15
|
-
# @param
|
16
|
-
# @param
|
13
|
+
# @param [Float] latitude.
|
14
|
+
# @param [Float] longitude.
|
15
|
+
# @param [String] timezonestring
|
16
|
+
# @param [Integer] method
|
17
17
|
# @param options [Hash], Have optional values like timestamp, that is default to Current timestamp
|
18
18
|
def timings(latitude:, longitude:, timezonestring:, method:, options: {})
|
19
19
|
timestamp = options[:timestamp] ? options[:timestamp] : Time.now.to_i
|
@@ -31,12 +31,12 @@ module Namaz
|
|
31
31
|
|
32
32
|
# Retrieve the namaz timings for a given city, country, method.
|
33
33
|
#
|
34
|
-
# @param
|
35
|
-
# @param
|
36
|
-
# @param
|
37
|
-
# @param
|
38
|
-
# @param
|
39
|
-
def
|
34
|
+
# @param [String] city
|
35
|
+
# @param [String] country
|
36
|
+
# @param [String] timezonestring
|
37
|
+
# @param [Integer] method
|
38
|
+
# @param [Hash] options, Have optional values like timestamp, that is default to Current timestamp
|
39
|
+
def timings_by_city(city:, country:, method:, options: {})
|
40
40
|
timestamp = options[:timestamp] ? options[:timestamp] : Time.now.to_i
|
41
41
|
namaz_url = [DEFAULT_API_URL, 'timingsByCity', timestamp].join('/')
|
42
42
|
|
@@ -69,8 +69,8 @@ module Namaz
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def namaz_response(namaz_url, params)
|
72
|
-
|
73
|
-
return Hashie::Mash.new(MultiJson.load(
|
72
|
+
response = connection.get(namaz_url, params)
|
73
|
+
return Hashie::Mash.new(MultiJson.load(response.body)).data.timings if response.success?
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
data/lib/namaz/version.rb
CHANGED
data/namaz.gemspec
CHANGED
@@ -30,6 +30,11 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
+
spec.add_dependency 'faraday', '~> 0'
|
34
|
+
spec.add_dependency 'multi_json', '~> 0'
|
35
|
+
spec.add_dependency 'hashie', '~> 0'
|
36
|
+
|
37
|
+
spec.add_development_dependency 'typhoeus', '~> 0'
|
33
38
|
spec.add_development_dependency "bundler", "~> 1.13"
|
34
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,15 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namaz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sohair Ahmad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
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: multi_json
|
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: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
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: typhoeus
|
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'
|
13
69
|
- !ruby/object:Gem::Dependency
|
14
70
|
name: bundler
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|