nugz 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f0a17460e8f4c454cc5d3367200cc5a7737eca1d
4
+ data.tar.gz: 9f695010ff361414a7346292b35b202f1a063c65
5
+ SHA512:
6
+ metadata.gz: feb17e203c2c87bd5bba338510ddbe2799d3c116c22f4cd16290ffe57ec2470926575c2bf3cd97326ba6e08c2777eb4072ba04722a48a115cf397b69c1f50a8b
7
+ data.tar.gz: 109b36c71e8f5a1765d5a54578d7ccba8570a9810ec43a208529d6c74d6dba409ef6c49ef4ab6bd21878ae6fbb38df90dd91331ce4839554ddf84bd1b4747ea4
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ben Lewis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,50 @@
1
+ # Nugz
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'nugz'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install nugz
18
+
19
+ ## Usage
20
+
21
+ The Nugz gem makes it easy to consume the MileHigh API, which
22
+ can be found at http://www.milehighbuzz.co/api/v1/reviews
23
+ and http://www.milehighbuzz.co/api/v1/stores.
24
+
25
+ To get information about reviews and stores, use Nugz::Reviews and Nugz::Stores.
26
+ Here are the methods that they provide:
27
+
28
+ `Nugz::Reviews.all` gives back an array of hashes that contain information
29
+ about all of the reviews in the system.
30
+
31
+ `Nugz::Reviews.find_store(slug)` gives back an array of hashes that each contain
32
+ a review about that store. You need to pass in the slugified version of the
33
+ store name to use this method.
34
+
35
+ `Nugz::Stores.all` gives back an array of hashes that contain information
36
+ about all of the stores in the system.
37
+
38
+ `Nugz::Stores.find_store(slug)` gives back a hash that contains the information
39
+ about the store searched for. You need to pass in the slugified version of the
40
+ store name to use this method.
41
+
42
+
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,9 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ require "nugz/version"
5
+ require "nugz/reviews"
6
+ require "nugz/stores"
7
+
8
+ module Nugz
9
+ end
@@ -0,0 +1,13 @@
1
+ module Nugz
2
+ class Reviews
3
+ def self.all
4
+ response = Faraday.get('http://www.milehighbuzz.co/api/v1/reviews')
5
+ JSON.parse(response.body)
6
+ end
7
+
8
+ def self.for_store(slug)
9
+ response = Faraday.get("http://www.milehighbuzz.co/api/v1/reviews/store/#{slug}")
10
+ JSON.parse(response.body)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Nugz
2
+ class Stores
3
+
4
+ def self.all
5
+ response = Faraday.get('http://www.milehighbuzz.co/api/v1/stores')
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ def self.find_store(slug)
10
+ response = Faraday.get("http://www.milehighbuzz.co/api/v1/stores/#{slug}")
11
+ JSON.parse(response.body)
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Nugz
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nugz/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nugz"
8
+ spec.version = Nugz::VERSION
9
+ spec.authors = ["Ben Lewis", "Ben Horne", "Bryana Knight", "Darryl Pequeen"]
10
+ spec.email = ["bennlewis@gmail.com", "benhorne44@gmail.com", "brknig11@gmail", "pequickster@msn.com"]
11
+ spec.description = "The Nugz gem makes it easy to consume the MileHigh API. It
12
+ can be found at http://www.milehighbuzz.co/api/v1/reviews
13
+ and http://www.milehighbuzz.co/api/v1/stores."
14
+ spec.summary = "This gem makes it easy to consume the MileHigh API."
15
+ spec.homepage = "http://www.milehighbuzz.co"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "pry"
27
+
28
+ spec.add_dependency "faraday"
29
+ spec.add_dependency "json"
30
+ end
@@ -0,0 +1,81 @@
1
+ require './lib/nugz'
2
+
3
+ describe Nugz::Stores do
4
+ it "should exist" do
5
+ expect(Nugz::Stores).to be
6
+ end
7
+
8
+ it "should fetch all stores from the API" do
9
+ result = Nugz::Stores.all
10
+ expect(result).to have_at_least(3).items
11
+ expect(result).to be_a_kind_of(Array)
12
+ expect(result.first).to be_a_kind_of(Hash)
13
+ expect(result.first).to have_key("slug")
14
+ expect(result.first).to have_key("name")
15
+ expect(result.first).to have_key("address")
16
+ expect(result.first).to have_key("city")
17
+ expect(result.first).to have_key("state")
18
+ expect(result.first).to have_key("zipcode")
19
+ expect(result.first).to have_key("hours")
20
+ expect(result.first).to have_key("website")
21
+ expect(result.first).to have_key("phone_number")
22
+ expect(result.first).to have_key("menu")
23
+ expect(result.first["slug"]).to_not eq("")
24
+ expect(result.first["name"]).to_not eq("")
25
+ end
26
+
27
+ it "should fetch a single store from the API" do
28
+ to_find = Nugz::Stores.all.first["slug"]
29
+
30
+ result = Nugz::Stores.find_store(to_find)
31
+ expect(result).to be_a_kind_of(Hash)
32
+ expect(result).to have_key("slug")
33
+ expect(result).to have_key("name")
34
+ expect(result).to have_key("address")
35
+ expect(result).to have_key("city")
36
+ expect(result).to have_key("state")
37
+ expect(result).to have_key("zipcode")
38
+ expect(result).to have_key("hours")
39
+ expect(result).to have_key("website")
40
+ expect(result).to have_key("phone_number")
41
+ expect(result).to have_key("menu")
42
+ expect(result["slug"]).to eq(to_find)
43
+ expect(result["name"]).to_not eq("")
44
+ end
45
+ end
46
+
47
+
48
+
49
+
50
+
51
+ describe Nugz::Reviews do
52
+ it "should exist" do
53
+ expect(Nugz::Reviews).to be
54
+ end
55
+
56
+ it "should fetch all reviews from the API" do
57
+ result = Nugz::Reviews.all
58
+ expect(result).to have_at_least(3).items
59
+ expect(result).to be_a_kind_of(Array)
60
+ expect(result.first).to be_a_kind_of(Hash)
61
+ expect(result.first).to have_key("user_id")
62
+ expect(result.first).to have_key("store_id")
63
+ expect(result.first).to have_key("rating")
64
+ expect(result.first).to have_key("title")
65
+ expect(result.first).to have_key("body")
66
+ expect(result.first["store_id"]).to_not eq("")
67
+ end
68
+
69
+ it "should fetch all reviews for a single store from the API" do
70
+ to_find = Nugz::Stores.all.first["slug"]
71
+ result = Nugz::Reviews.for_store(to_find)
72
+ expect(result).to be_a_kind_of(Array)
73
+ expect(result.first).to have_key("slug")
74
+ expect(result.first["slug"]).to eq(to_find)
75
+
76
+ expect(result.last).to have_key("rating")
77
+ expect(result.last).to have_key("title")
78
+ expect(result.last).to have_key("body")
79
+ end
80
+
81
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nugz
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Lewis
8
+ - Ben Horne
9
+ - Bryana Knight
10
+ - Darryl Pequeen
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2014-01-22 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.3'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: rspec
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: pry
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ - !ruby/object:Gem::Dependency
73
+ name: faraday
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ - !ruby/object:Gem::Dependency
87
+ name: json
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ type: :runtime
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ description: |-
101
+ The Nugz gem makes it easy to consume the MileHigh API. It
102
+ can be found at http://www.milehighbuzz.co/api/v1/reviews
103
+ and http://www.milehighbuzz.co/api/v1/stores.
104
+ email:
105
+ - bennlewis@gmail.com
106
+ - benhorne44@gmail.com
107
+ - brknig11@gmail
108
+ - pequickster@msn.com
109
+ executables: []
110
+ extensions: []
111
+ extra_rdoc_files: []
112
+ files:
113
+ - .gitignore
114
+ - Gemfile
115
+ - LICENSE.txt
116
+ - README.md
117
+ - Rakefile
118
+ - lib/nugz.rb
119
+ - lib/nugz/reviews.rb
120
+ - lib/nugz/stores.rb
121
+ - lib/nugz/version.rb
122
+ - nugz.gemspec
123
+ - spec/nugz_spec.rb
124
+ homepage: http://www.milehighbuzz.co
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.1.11
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: This gem makes it easy to consume the MileHigh API.
148
+ test_files:
149
+ - spec/nugz_spec.rb