Class: Statium::Opta::Client
- Inherits:
- 
      Object
      
        - Object
- Statium::Opta::Client
 
- Defined in:
- lib/statium/opta/client.rb
Instance Method Summary collapse
- #load(auth_key, lang = 'en', resource, &completion) ⇒ Object
- #load_from_file(filename, resource) {|true, parse_JSON(resource, File.read(filename))| ... } ⇒ Object
Instance Method Details
#load(auth_key, lang = 'en', resource, &completion) ⇒ Object
| 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # File 'lib/statium/opta/client.rb', line 12 def load(auth_key, lang = 'en', resource, &completion) request_uri = resource.uri(auth_key, lang) res = Net::HTTP.get_response(request_uri) # Uncomment to debug # puts res.code # puts res.message # puts res.body if res.is_a?(Net::HTTPSuccess) yield(true, parse_JSON(resource, res.body)) else yield(false, res.) end end | 
#load_from_file(filename, resource) {|true, parse_JSON(resource, File.read(filename))| ... } ⇒ Object
| 28 29 30 | # File 'lib/statium/opta/client.rb', line 28 def load_from_file(filename, resource, &completion) yield(true, parse_JSON(resource, File.read(filename))) end |