vakit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c416f02f9a06fa30134565430737f186a6c9f9c2
4
+ data.tar.gz: 9deb9f2f1307bbea16eab1212f4b17691bb9554b
5
+ SHA512:
6
+ metadata.gz: 3487d1af0cb9066a2d782d1773d78258bf842ff59ab65086fd3310d1e3ed68c440a5b853b5e15d7746ed2772977a6d612fd00397cfc1a42654bb3b45c0006b22
7
+ data.tar.gz: 85a33c003583cb5eb5e655dd34f97e527c3dd4fd5ea64ce0da09b5d7c452d1965d10b0fa3b2cbebeff41e6a2882067948b08af642351aa16badaca68085800bf
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ vakit
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vakit.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 scary.mac
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Vakit
2
+ Vakit is a small tool which fetches prayer times for Turkey from www.samanyoluhaber.com and persists data in a Rails way.
3
+
4
+ ## Installation
5
+ ```ruby
6
+ gem 'vakit'
7
+ ```
8
+ and just do a `bundle install` as usual.
9
+
10
+ ## Usage
11
+ Using 'Vakit' is extremely easy. You're ready to go by just calling right keyword of returning hash:
12
+
13
+ - For Fajr
14
+ ```console
15
+ $ Vakit.imsak
16
+ ```
17
+
18
+ - For Shorook
19
+ ```console
20
+ $ Vakit.sabah
21
+ ```
22
+
23
+ - For Zuhr
24
+ ```console
25
+ $ Vakit.oglen
26
+ ```
27
+
28
+ - For Asr
29
+ ```console
30
+ $ Vakit.ikindi
31
+ ```
32
+
33
+ - For Maghrib
34
+ ```console
35
+ $ Vakit.aksam
36
+ ```
37
+
38
+ - For Isha
39
+ ```console
40
+ $ Vakit.yatsi
41
+ ```
42
+
43
+ ## Contribution
44
+
45
+ Any kind of contribution is welcomed.
46
+
47
+ ## Testing
48
+ We're using RSPEC.
49
+
50
+ ## License
51
+ GPL
52
+ Completly free :)
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,33 @@
1
+ module Vakit
2
+ class Connect
3
+ def initialize(opt={})
4
+ @path = opt[:path]
5
+ end
6
+
7
+ def self.shaber
8
+ doc = Nokogiri::HTML(open('http://www.samanyoluhaber.com/'))
9
+ x = doc.css('#hnmzT')
10
+
11
+ times = []
12
+ x.each do |vakit|
13
+ data = vakit.children.first.children.last.content
14
+ data_add = data.slice(0..data.length-2)
15
+ times.push(data_add)
16
+ end
17
+ times
18
+ vakit = {
19
+
20
+ imsak: times[0],
21
+ sabah: times[1],
22
+ oglen: times[2],
23
+ ikindi: times[3],
24
+ aksam: times[4],
25
+ yatsi: times[5]
26
+
27
+
28
+ }
29
+
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module Vakit
2
+ VERSION = "0.1.0"
3
+ end
data/lib/vakit.rb ADDED
@@ -0,0 +1,36 @@
1
+ require "vakit/version"
2
+ require 'vakit/connect'
3
+ require 'Nokogiri'
4
+ require 'open-uri'
5
+
6
+ module Vakit
7
+
8
+ def self.today
9
+ Vakit::Connect.shaber
10
+ end
11
+
12
+ def self.imsak
13
+ Vakit::Connect.shaber[:imsak]
14
+ end
15
+
16
+ def self.sabah
17
+ Vakit::Connect.shaber[:sabah]
18
+ end
19
+
20
+ def self.oglen
21
+ Vakit::Connect.shaber[:oglen]
22
+ end
23
+
24
+ def self.ikindi
25
+ Vakit::Connect.shaber[:ikindi]
26
+ end
27
+
28
+ def self.aksam
29
+ Vakit::Connect.shaber[:aksam]
30
+ end
31
+
32
+ def self.yatsi
33
+ Vakit::Connect.shaber[:yatsi]
34
+ end
35
+
36
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+
4
+
5
+ describe "Connector#new" do
6
+ let(:connector) { Vakit::Connect }
7
+ subject { connector }
8
+ it { should respond_to(:new)}
9
+
10
+
11
+ context "Conect to samanyoluhaber.com" do
12
+ let(:connector) { Vakit::Connect.shaber }
13
+ subject { connector }
14
+
15
+ describe "connected" do
16
+ it { should be_a(Hash)}
17
+ its(:length) { should == 6 }
18
+ end
19
+
20
+ describe "data" do
21
+
22
+ it { should include(:imsak)}
23
+ it { should include(:sabah)}
24
+ it { should include(:oglen)}
25
+ it { should include(:ikindi)}
26
+ it { should include(:aksam)}
27
+ it { should include(:yatsi)}
28
+
29
+ end
30
+
31
+
32
+
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'vakit'
4
+ Bundler.require(:default)
5
+ # This file was generated by the `rspec --init` command. Conventionally, all
6
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
+ # Require this file using `require "spec_helper"` to ensure that it is only
8
+ # loaded once.
9
+ #
10
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+
16
+ # Run specs in random order to surface order dependencies. If you find an
17
+ # order dependency and want to debug it, you can fix the order by providing
18
+ # the seed, which is printed after each run.
19
+ # --seed 1234
20
+ config.order = 'random'
21
+ end
data/vakit.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vakit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vakit"
8
+ spec.version = Vakit::VERSION
9
+ spec.authors = ["scary.mac"]
10
+ spec.email = ["soner2@gmail.com"]
11
+ spec.description = %q{A gem for easily getting salah times for Turkey}
12
+ spec.summary = %q{Salah times for Turkey}
13
+ spec.homepage = "http://github.com/scaryguy/vakit"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+
25
+ spec.add_runtime_dependency "nokogiri"
26
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vakit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - scary.mac
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A gem for easily getting salah times for Turkey
70
+ email:
71
+ - soner2@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - .ruby-gemset
79
+ - .ruby-version
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - lib/vakit.rb
85
+ - lib/vakit/connect.rb
86
+ - lib/vakit/version.rb
87
+ - spec/connector_spec.rb
88
+ - spec/spec_helper.rb
89
+ - vakit.gemspec
90
+ homepage: http://github.com/scaryguy/vakit
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Salah times for Turkey
114
+ test_files:
115
+ - spec/connector_spec.rb
116
+ - spec/spec_helper.rb