Module: Interwetten::CommonMethods
- Included in:
- MarketsClient, ResultsClient
- Defined in:
- lib/interwetten/common_methods.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#sport_id ⇒ Object
readonly
Returns the value of attribute sport_id.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#language ⇒ Object (readonly)
Returns the value of attribute language.
6 7 8 |
# File 'lib/interwetten/common_methods.rb', line 6 def language @language end |
#sport_id ⇒ Object (readonly)
Returns the value of attribute sport_id.
6 7 8 |
# File 'lib/interwetten/common_methods.rb', line 6 def sport_id @sport_id end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
6 7 8 |
# File 'lib/interwetten/common_methods.rb', line 6 def xml @xml end |
Class Method Details
.get_sports(language = "EN") ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/interwetten/common_methods.rb', line 19 def self.get_sports(language = "EN") params = { "FEEDPARAMS" => "ValidKindofsports", "LANGUAGE" => language } sports_url = "http://ad.interwetten.com/XMLFeeder/feeder.asmx/getfeed?#{params.to_query.gsub("&", "|")}" begin sports_xml = Nokogiri::XML(open(URI.escape(sports_url))).remove_namespaces! sports_xml.search("KINDOFSPORT").inject({}) do |res, value| res.merge( { value.get_attribute("NAME") => value.get_attribute("ID") } ) end rescue end end |
Instance Method Details
#initialize(sport_id, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/interwetten/common_methods.rb', line 8 def initialize(sport_id, = {}) @sport_id = sport_id.is_a?(Array) ? sport_id.join(",") : sport_id () url = generate_url begin @xml = Nokogiri::XML(open(URI.escape(url))).remove_namespaces! rescue end end |