asianodds 0.1.2

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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 88b0528ebf9c14e4e703b0134b6c1a9812239ef6
4
+ data.tar.gz: b115cf50cf47e53bb7d8f71a5511f5b388b1d9fe
5
+ SHA512:
6
+ metadata.gz: 3a7745129208e5004e25644d8ed16edc9c515e56af31431b7525800e2a86c486c73301dd0630d58610e9553b719959fc23625bd230ad2d356a0881177de664d2
7
+ data.tar.gz: cb893a214cac9e5ba8eb6db236dbae59a63029a4f55776ea0dddbaa883f395f0a82f3d7cae2f400fed092e344384d78a6eb7a28bac9f64b3e5a880b4cd171e8d
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in asianodds.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rubocop'
8
+ end
9
+
10
+ group :development do
11
+ gem 'bundler', '~> 1.13'
12
+ gem 'rake', '~> 10.0'
13
+ gem 'minitest'
14
+ end
@@ -0,0 +1,35 @@
1
+ # Asianodds
2
+
3
+ This gem is a wrapper for the Asianodds Web API.
4
+ In order to use this gem you need to apply for a Web API account with Asianodds (api@asianodds88.com). Please keep in mind that your regular Asianodds user (for the Web Interface) does not work for your API account and vice versa.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'asianodds'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install asianodds
21
+
22
+ ## Usage
23
+
24
+ Login to AsianOdds
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/asianodds.
35
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'asianodds/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "asianodds"
8
+ spec.version = Asianodds::VERSION
9
+ spec.authors = ["Jan Runo"]
10
+ spec.email = ["jan.runo@whu.edu"]
11
+
12
+ spec.summary = %q{A wrapper for the Asianodds web API for automated sports trading}
13
+ spec.description = %q{description}
14
+ spec.homepage = "https://github.com/Jan17392/asianodds"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "faraday"
33
+ spec.add_dependency "json"
34
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asianodds"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require_relative "asianodds/version"
2
+ require_relative "asianodds/login"
@@ -0,0 +1,41 @@
1
+ require 'faraday'
2
+ require 'json'
3
+ require 'digest/md5'
4
+
5
+ BASE_API_URL = "https://webapi.asianodds88.com/AsianOddsService"
6
+
7
+ module Asianodds
8
+ class Login
9
+
10
+ attr_reader :code, :ao_token, :ao_key, :base_url, :successful_login, :message
11
+
12
+ # Initialize the user with a username and password
13
+ def initialize(user, password)
14
+ @user = user
15
+ @password = password
16
+
17
+ # Asianodds requests the password to be MD5 hashed
18
+ @password_md5 = Digest::MD5.hexdigest(@password)
19
+
20
+
21
+ self.login
22
+ end
23
+
24
+ def login
25
+ response = Faraday.get("#{BASE_API_URL}/Login?username=#{@user}&password=#{@password_md5}")
26
+ attributes = JSON.parse(response.body)
27
+
28
+ @code = attributes["Code"]
29
+ @ao_token = attributes["Result"]["Token"]
30
+ @ao_key = attributes["Result"]["Key"]
31
+ @base_url = attributes["Result"]["Url"]
32
+ @successful_login = attributes["Result"]["SuccessfulLogin"]
33
+ @message = attributes["Result"]["TextMessage"]
34
+ end
35
+
36
+ # Check for all other requests whether user is logged in and if not, log her in
37
+
38
+
39
+
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ module Asianodds
2
+ VERSION = "0.1.2"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asianodds
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Jan Runo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-04-26 00:00:00.000000000 Z
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: 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
+ description: description
42
+ email:
43
+ - jan.runo@whu.edu
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - asianodds.gemspec
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/asianodds.rb
56
+ - lib/asianodds/login.rb
57
+ - lib/asianodds/version.rb
58
+ homepage: https://github.com/Jan17392/asianodds
59
+ licenses: []
60
+ metadata:
61
+ allowed_push_host: https://rubygems.org
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.5.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A wrapper for the Asianodds web API for automated sports trading
82
+ test_files: []