Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Joshua Lind
BetfairNGAPI
Commits
236ebd00
Commit
236ebd00
authored
Nov 24, 2014
by
Sergey Gernyak
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temp
parent
b5347a80
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
lib/betfair_api_ng_rails/api/connection.rb
lib/betfair_api_ng_rails/api/connection.rb
+1
-1
lib/betfair_api_ng_rails/api/helper.rb
lib/betfair_api_ng_rails/api/helper.rb
+1
-1
lib/betfair_api_ng_rails/api/http/factory.rb
lib/betfair_api_ng_rails/api/http/factory.rb
+5
-5
lib/betfair_api_ng_rails/api/provider.rb
lib/betfair_api_ng_rails/api/provider.rb
+5
-6
No files found.
lib/betfair_api_ng_rails/api/connection.rb
View file @
236ebd00
...
...
@@ -4,7 +4,7 @@ module BetfairApiNgRails
module
Api
class
Connection
def
request
(
method
,
params
=
{})
provider
.
fetch
method:
Api
::
RequestMethod
.
new
(
method
)
,
params:
hashing
(
params
)
provider
.
fetch
method:
method
,
params:
hashing
(
params
)
end
include
Api
::
ConnectionExt
::
Caching
...
...
lib/betfair_api_ng_rails/api/helper.rb
View file @
236ebd00
...
...
@@ -18,7 +18,7 @@ module BetfairApiNgRails
def
prepare_api_req_json
(
method
,
params
)
{
"jsonrpc"
=>
"2.0"
,
"method"
=>
"
#{
method
.
json_method
}
/v1.0/
#{
method
.
name
}
"
,
"method"
=>
"
SportsAPING
/v1.0/
#{
method
}
"
,
"params"
=>
params
}.
to_json
end
...
...
lib/betfair_api_ng_rails/api/http/factory.rb
View file @
236ebd00
...
...
@@ -5,11 +5,11 @@ module BetfairApiNgRails
class
<<
self
include
Api
::
Constants
def
provider_requester
(
api_url
,
ssoid
=
nil
)
req
=
create_http_requester
(
api_url
)
req
.
set_request_headers
API_REQUEST_HEADERS
req
.
set_auth_headers
Api
::
Config
.
application_key
,
ssoid
req
def
provider_requester
(
ssoid
=
nil
)
create_http_requester
(
API_URL
[
:betting
]).
tap
do
|
req
|
req
.
set_request_headers
API_REQUEST_HEADERS
req
.
set_auth_headers
Api
::
Config
.
application_key
,
ssoid
end
end
def
session_requester
...
...
lib/betfair_api_ng_rails/api/provider.rb
View file @
236ebd00
...
...
@@ -14,20 +14,19 @@ module BetfairApiNgRails
end
def
fetch
(
method:
""
,
params:
{})
raise
"Not allowed method
#{
method
.
name
}
"
unless
method
.
allowed?
#
raise "Not allowed method #{method.name}" unless method.allowed?
run_request
for_method:
method
,
params:
params
end
private
def
run_request
(
for_method:
""
,
params:
{})
requester
=
http_requester
(
for_method
.
api_url
)
requester
.
set_api_req_body
for_method
,
params
requester
.
do_request
http_requester
.
set_api_req_body
for_method
,
params
http_requester
.
do_request
end
def
http_requester
(
api_url
)
@_http_requester
||=
Api
::
Http
::
Factory
.
provider_requester
api_url
,
ssoid
def
http_requester
@_http_requester
||=
Api
::
Http
::
Factory
.
provider_requester
ssoid
end
end
end
...
...
Joshua Lind
@jdl11
mentioned in commit
a941d00b
·
Jan 15, 2015
mentioned in commit
a941d00b
mentioned in commit a941d00b284bcc133572c479766988dcbf94b42c
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment