docsearch_api 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ require 'active_support'
2
+ require 'active_resource'
3
+
4
+ module DocsearchAPI
5
+ mattr_accessor :api_key
6
+ end
7
+
8
+ require 'docsearch_api/provider'
@@ -0,0 +1,42 @@
1
+ module DocsearchAPI
2
+ class Provider < ActiveResource::Base
3
+ self.site = 'http://doctors.imedo.de/api'
4
+
5
+ def to_param
6
+ permalink
7
+ end
8
+
9
+ def full_name
10
+ [title, first_name, last_name].compact.join(' ')
11
+ end
12
+
13
+ def has_hours?
14
+ (0..6).to_a.each do |day|
15
+ shortcut = Date::DAYNAMES[day][0..1].downcase
16
+ return true if !self.send(:"hour_#{shortcut}_am").blank? || !self.send(:"hour_#{shortcut}_pm").blank?
17
+ end
18
+ return false
19
+ end
20
+
21
+ def has_hour_footnotes?
22
+ !hour_footnotes.empty?
23
+ end
24
+
25
+ def hour_footnotes
26
+ (1..4).to_a.collect { |fn| [fn, self.send(:"hour_footnote_#{fn}")] }.reject { |e| e[1].blank? }
27
+ end
28
+
29
+ class << self
30
+ def search(options)
31
+ find_every :from => :search, :params => options
32
+ end
33
+
34
+ private
35
+ def query_string_with_api_key(options)
36
+ query_string_without_api_key(options.merge(:api_key => DocsearchAPI.api_key))
37
+ end
38
+
39
+ alias_method_chain :query_string, :api_key
40
+ end
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docsearch_api
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Thomas Kadauke
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-10 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: tkadauke@imedo.de
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/docsearch_api/provider.rb
32
+ - lib/docsearch_api.rb
33
+ has_rdoc: true
34
+ homepage: http://www.imedo.de
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Client library for accessing the imedo doctor search database
67
+ test_files: []
68
+