vfnetapis 0.0.1 → 0.0.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.
@@ -1,3 +1,3 @@
1
1
  module Vfnetapis
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/vfnetapis.rb CHANGED
@@ -3,6 +3,7 @@ require 'rest-client'
3
3
  require 'JSON'
4
4
  require 'launchy'
5
5
  require 'uri'
6
+ require 'logger'
6
7
 
7
8
  module Vfnetapis
8
9
  class Location
@@ -19,7 +20,8 @@ module Vfnetapis
19
20
  attr_reader :accuracy
20
21
  attr_reader :timestamp
21
22
  attr_reader :response
22
- @@loc_api="http://79.125.107.189/v2/location/queries/location"
23
+ @@loc_api="http://api.developer.vodafone.com/v2/location/queries/location"
24
+ # @@loc_api="http://79.125.107.189/v2/location/queries/location"
23
25
  @@auth_server = "http://79.125.107.189/2/oauth/authorize"
24
26
  @@acc_server = "http://176.34.213.154/2/oauth/access_token?client_id="
25
27
 
@@ -35,16 +37,20 @@ module Vfnetapis
35
37
  puts 'Auth Token is:' + @auth_token
36
38
  @access_token = get_access_token(@auth_token)
37
39
  puts 'Access Token is:' + @access_token
38
-
40
+
39
41
  @response = RestClient.get @@loc_api, :authorization=> 'Oauth ' + @access_token, :params => {:address => URI.escape(address,':'), :requestedAccuracy => requested_accuracy}
40
-
41
42
  resJson = JSON.parse(@response)
42
- @longitude = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["longitude"]
43
- @latitude = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["latitude"]
44
- @altitude = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["altitude"]
45
- @accuracy = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["accuracy"]
46
- @timestamp = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["timestamp"]
47
- @address = resJson["terminalLocationList"]["terminalLocation"]["address"]
43
+
44
+ if resJson["terminalLocationList"]["terminalLocation"]["locationRetrievalStatus"] == "NotRetrieved"
45
+ @longitude = @latitude = @altitude = "Not Found"
46
+ else
47
+ @longitude = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["longitude"]
48
+ @latitude = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["latitude"]
49
+ @altitude = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["altitude"]
50
+ @accuracy = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["accuracy"]
51
+ @timestamp = resJson["terminalLocationList"]["terminalLocation"]["currentLocation"]["timestamp"]
52
+ end
53
+ @address = resJson["terminalLocationList"]["terminalLocation"]["address"]
48
54
  end
49
55
 
50
56
  def get_auth_token(redirectURI,scope) # => start consent flow to send code to redirectURI
data/vfnetapis.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["kevin.smith@vodafone.com"]
7
7
  gem.description = "OAUTH with OneAPI calls against Vodafone's OneAPI endpoint."
8
8
  gem.summary = "Network API helpers for reading a user's location and brokering the OAUTH dance."
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/OneAPI/vfnetapis"
10
10
 
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
12
  gem.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vfnetapis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-30 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: OAUTH with OneAPI calls against Vodafone's OneAPI endpoint.
15
15
  email:
@@ -27,7 +27,7 @@ files:
27
27
  - lib/vfnetapis.rb
28
28
  - lib/vfnetapis/version.rb
29
29
  - vfnetapis.gemspec
30
- homepage: ''
30
+ homepage: https://github.com/OneAPI/vfnetapis
31
31
  licenses: []
32
32
  post_install_message:
33
33
  rdoc_options: []