yoyo 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 61b8a46f7c094e74fddf2f2fb5f4334fe71f200d
4
- data.tar.gz: 20c990c37d6fa9ba34caf3e4fbd315eac84bcd59
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWZmZGJhYTIxZDIwNWM4MWFiZTQ4ODgxNzM3N2VjNWM2MDhmMTkyZQ==
5
+ data.tar.gz: !binary |-
6
+ ODE1MzUwZjBlMGIyZWNhMDM2OGMwZjhlOTc2NWFmY2I2YmZlYzgzMA==
5
7
  SHA512:
6
- metadata.gz: 496d07bb160e35ebe719c20e0c0b69ed2ef4cbb3e1cc63c86f4a4e5162f4df485c45bb80e10be1c2ae9b279d1adff17c4524586b3759cf11120ace3e1490399d
7
- data.tar.gz: a4ef8e49e79617660e88094e6e7659574b47b14dc93d3512609e6e18b7d54fccf3a3b86ee05fd89c96a7f706c4987dcd720b1e4c512ac29525591d73156c55db
8
+ metadata.gz: !binary |-
9
+ ZjM1NmI2YTVkNTM2ZmEzZjdkZjczZTNlNjRmN2VhNWI2MmU4YmE1YWFkOTRh
10
+ MjRmNzQ2YWJkMWRjN2U4OTMyNTI2Zjc4OTkwYmZjZDFjYzNhNmI5NjMyN2Jj
11
+ ZmMxZjc2NTdlYTU1OTE1ZTA5NzMyNzdlOWU5NGIwZDE2MTVmZTY=
12
+ data.tar.gz: !binary |-
13
+ NGNjY2FlZjY0NTU4NjY3MDVmZDkwNzllZjRlOWJkZDIzOTcxNzAzMjE1MjFj
14
+ MGYyMmMyZTY0YzgzOTU5OTk4OTJjNWUxYzU1M2YzODcxNDNmODRhMThlMjQ2
15
+ YTAxYjg1ZGM1ZjQ2MTgzODgwYWRhOGMwNGRkN2E5YTFjYjIyZDg=
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - jruby
7
+ - rbx
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A ruby gem for using the YO API. You know you need this.
4
4
 
5
+ [![Build Status](https://travis-ci.org/philcrissman/yoyo.svg)](https://travis-ci.org/philcrissman/yoyo)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -4,6 +4,8 @@ require 'json'
4
4
  require 'ostruct'
5
5
 
6
6
  module Yoyo
7
+ InvalidLocationError = Class.new(StandardError)
8
+
7
9
  class Yo
8
10
  # = Yoyo
9
11
  #
@@ -68,6 +70,8 @@ module Yoyo
68
70
  private
69
71
 
70
72
  def build_result(method, path, opts={})
73
+ assert_valid_location!(opts[:location], opts[:link])
74
+
71
75
  tap do
72
76
  response = api_connection.send(method, path, opts.merge(api_token: api_token))
73
77
  begin
@@ -88,6 +92,13 @@ module Yoyo
88
92
  })
89
93
  end
90
94
  end
95
+
96
+ def assert_valid_location!(location, link)
97
+ return true unless location
98
+ raise InvalidLocationError, ":location may not be requested with :link" if location && link
99
+ raise InvalidLocationError, ":location must be in format 'lat;long'" unless location.split(';').compact.size == 2
100
+ true
101
+ end
91
102
  end
92
103
  end
93
104
 
@@ -1,5 +1,5 @@
1
1
  module Yoyo
2
2
  # This is what version of Yoyo this is!
3
3
  # They grow up so fast.
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -72,4 +72,21 @@ class YoyoTest < Minitest::Test
72
72
  yo.yo_all link: "http://justyo.co"
73
73
  assert_equal "{}", yo.result.response.body
74
74
  end
75
+
76
+ def test_yo_with_valid_location
77
+ yo.yo("PHILCRISSMAN", location: "51.5033630;-0.1276250")
78
+ assert_equal({'result' => "OK"}, yo.result.parsed)
79
+ end
80
+
81
+ def test_yo_with_invalid_location
82
+ assert_raises Yoyo::InvalidLocationError do
83
+ yo.yo("PHILCRISSMAN", location: "51.5033630,-0.1276250")
84
+ end
85
+ end
86
+
87
+ def test_yo_with_link_and_location
88
+ assert_raises Yoyo::InvalidLocationError do
89
+ yo.yo("PHILCRISSMAN", location: "51.5033630;-0.1276250", link: "http://justyo.co")
90
+ end
91
+ end
75
92
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoyo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Crissman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-19 00:00:00.000000000 Z
12
+ date: 2014-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -29,56 +29,56 @@ dependencies:
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ! '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ! '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: mocha
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: faraday
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ! '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: It's a ruby gem for using the YO API. You need to get an API Token, okay?
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - .gitignore
92
+ - .travis.yml
92
93
  - Gemfile
93
94
  - LICENSE.txt
94
95
  - README.md
@@ -107,17 +108,17 @@ require_paths:
107
108
  - lib
108
109
  required_ruby_version: !ruby/object:Gem::Requirement
109
110
  requirements:
110
- - - '>='
111
+ - - ! '>='
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0'
113
114
  required_rubygems_version: !ruby/object:Gem::Requirement
114
115
  requirements:
115
- - - '>='
116
+ - - ! '>='
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  requirements: []
119
120
  rubyforge_project:
120
- rubygems_version: 2.3.0
121
+ rubygems_version: 2.2.2
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: A ruby gem for using the YO API