bazaar_voice 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3f611880f32476709b5462d65ef6cf93cbd88fa0
4
+ data.tar.gz: 8548328f10b53d42c51cfc573a678ddd1b1081e6
5
+ SHA512:
6
+ metadata.gz: 2f514942827c750a0489bb5bd63407d595820c5450e731268bc6f894fb191d8d5da5afa835b9d86c6e980bf268cd1c5168fde4f4c05cbe42737ffbae639cd529
7
+ data.tar.gz: 69e7898235ff7de373dbca002c7e359b54447b7ae8cfcd2a0f8031f2f7c8a8c9095e7fa607e8234cb6f27d96aca6ef6e4a3ca14c7367383ae1de067ad60dc054
data/.gitignore ADDED
@@ -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/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,35 @@
1
+ require: rubocop-rspec
2
+
3
+
4
+ # This configuration was generated by `rubocop --auto-gen-config`
5
+ # on 2015-08-07 11:11:57 -0700 using RuboCop version 0.32.1.
6
+ # The point is for the user to remove these configuration records
7
+ # one by one as the offenses are removed from the code base.
8
+ # Note that changes in the inspected code, or installation of new
9
+ # versions of RuboCop, may require this file to be generated again.
10
+
11
+ # Offense count: 4
12
+ Metrics/AbcSize:
13
+ Max: 35
14
+
15
+ Metrics/LineLength:
16
+ Max: 300
17
+
18
+ # Offense count: 5
19
+ # Configuration parameters: CountComments.
20
+ Metrics/MethodLength:
21
+ Max: 40
22
+
23
+ # Offense count: 3
24
+ Style/ClassVars:
25
+ Enabled: false
26
+
27
+ # Offense count: 9
28
+ Style/Documentation:
29
+ Enabled: false
30
+
31
+ # Offense count: 50
32
+ # Cop supports --auto-correct.
33
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
34
+ Style/HashSyntax:
35
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bazaar_voice.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,66 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard :rspec, cmd: 'bundle exec rspec' do
19
+ require 'guard/rspec/dsl'
20
+ dsl = Guard::RSpec::Dsl.new(self)
21
+
22
+ # Feel free to open issues for suggestions and improvements
23
+
24
+ # RSpec files
25
+ rspec = dsl.rspec
26
+ watch(rspec.spec_helper) { rspec.spec_dir }
27
+ watch(rspec.spec_support) { rspec.spec_dir }
28
+ watch(rspec.spec_files)
29
+
30
+ # Ruby files
31
+ ruby = dsl.ruby
32
+ dsl.watch_spec_files_for(ruby.lib_files)
33
+
34
+ # Rails files
35
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
36
+ dsl.watch_spec_files_for(rails.app_files)
37
+ dsl.watch_spec_files_for(rails.views)
38
+
39
+ watch(rails.controllers) do |m|
40
+ [
41
+ rspec.spec.lambda.call("routing/#{m[1]}_routing"),
42
+ rspec.spec.lambda.call("controllers/#{m[1]}_controller"),
43
+ rspec.spec.lambda.call("acceptance/#{m[1]}")
44
+ ]
45
+ end
46
+
47
+ # Rails config changes
48
+ watch(rails.spec_helper) { rspec.spec_dir }
49
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
50
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
51
+
52
+ # Capybara features specs
53
+ watch(rails.view_dirs) { |m| rspec.spec.lambda.call("features/#{m[1]}") }
54
+ watch(rails.layouts) { |m| rspec.spec.lambda.call("features/#{m[1]}") }
55
+
56
+ # Turnip features and steps
57
+ watch(%r{^spec/acceptance/(.+)\.feature$})
58
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
59
+ Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
60
+ end
61
+ end
62
+
63
+ guard :rubocop do
64
+ watch(/.+\.rb$/)
65
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
66
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Dean Shelton
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # BazaarVoice
2
+
3
+ Talk to BazaarVoice's API and get back some json you can act on.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bazaar_voice'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bazaar_voice
20
+
21
+ ## Usage
22
+ ```
23
+ BizaarVoice::Api.config do |c|
24
+ c.passkey = 'YOUR_API_KEY_GOES_HERE'
25
+ c.protocol = 'http' # defautls to 'https'
26
+ c.host = 'stg.api.bazaarvoice.com' # defautls to production. i.e.: 'api.bazaarvoice.com'
27
+ c.format = 'whatever' # defautls to 'json'
28
+ end
29
+
30
+ # get all reviews
31
+ BizaarVoice::Api.get_reviews({'Limit' => 2, 'Filter' => 'ProductId:O-006-2034-R'})
32
+
33
+ # get all stories
34
+ BizaarVoice::Api.get_stories({'Limit' => 2, 'Filter' => 'ProductId:O-006-2034-R'})
35
+
36
+ # get all questions
37
+ BizaarVoice::Api.get_questions({'Limit' => 2, 'Filter' => 'ProductId:O-006-2034-R'})
38
+ ```
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+ 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).
45
+
46
+ ## Contributing
47
+
48
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bazaar_voice. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
49
+
50
+
51
+ ## License
52
+
53
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
54
+
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RuboCop::RakeTask.new(:spec)
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: :spec
@@ -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 'bazaar_voice/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bazaar_voice'
8
+ spec.version = BazaarVoice::VERSION
9
+ spec.authors = ['Dean Shelton']
10
+ spec.email = ['dshelt2@searshc.com']
11
+
12
+ spec.summary = 'A Ruby based Bazaar Voice API Wrapper'
13
+ spec.description = 'Talk to Bazzar Voice API\'s with this handy gem'
14
+ spec.homepage = 'https://github.com/deanshelton913/bazaar-voice'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.10'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'rspec', '~> 3.3', '>= 3.3.0'
25
+ spec.add_development_dependency 'rubocop', '~> 0.33', '>= 0.33.0'
26
+ spec.add_development_dependency 'guard-rspec', '~> 4.5', '>= 4.5.2'
27
+ spec.add_development_dependency 'guard-rubocop', '~> 1.2', '>= 1.2.0'
28
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.3', '>= 1.3.0'
29
+ spec.add_runtime_dependency 'rest-client', '~> 1.8', '>= 1.8.0'
30
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'bazaar_voice'
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,56 @@
1
+ require 'bazaar_voice/version'
2
+ require 'rest-client'
3
+
4
+ module BazaarVoice
5
+ class Api
6
+ class << self
7
+ attr_writer :configuration
8
+
9
+ def configuration
10
+ @configuration ||= Configuration.new
11
+ end
12
+
13
+ def reset
14
+ @configuration = Configuration.new
15
+ end
16
+
17
+ def configure
18
+ yield(configuration)
19
+ end
20
+
21
+ %w(reviews stories questions comments answers authors products statistics).each do |resource|
22
+ define_method("get_#{resource}") do |argument|
23
+ get(resource, argument)
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def get(resource, params)
30
+ RestClient.get(uri(resource, params))
31
+ end
32
+
33
+ def uri(resource, params)
34
+ "#{configuration.protocol}://#{configuration.host}/data/#{resource}.#{configuration.format}#{query_string(params)}"
35
+ end
36
+
37
+ def query_string(params)
38
+ all_params = { passkey: configuration.passkey, apiversion: configuration.apiversion }.merge(params)
39
+ '?' + all_params.map { |k, v| "#{k}=#{v}" }.join('&')
40
+ end
41
+ end
42
+ end
43
+
44
+ class Configuration
45
+ attr_accessor :passkey, :apiversion, :host, :resource, :protocol, :format
46
+ def initialize
47
+ @apiversion = '5.4'
48
+ @host = 'api.bazaarvoice.com'
49
+ @protocol = 'https'
50
+ @format = 'json'
51
+ end
52
+ end
53
+
54
+ class Error < StandardError
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module BazaarVoice
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bazaar_voice
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dean Shelton
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.3'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 3.3.0
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '3.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 3.3.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.33'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.33.0
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '0.33'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.33.0
81
+ - !ruby/object:Gem::Dependency
82
+ name: guard-rspec
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '4.5'
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 4.5.2
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '4.5'
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 4.5.2
101
+ - !ruby/object:Gem::Dependency
102
+ name: guard-rubocop
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '1.2'
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.2.0
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.2'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 1.2.0
121
+ - !ruby/object:Gem::Dependency
122
+ name: rubocop-rspec
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '1.3'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 1.3.0
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.3'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 1.3.0
141
+ - !ruby/object:Gem::Dependency
142
+ name: rest-client
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '1.8'
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: 1.8.0
151
+ type: :runtime
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '1.8'
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: 1.8.0
161
+ description: Talk to Bazzar Voice API's with this handy gem
162
+ email:
163
+ - dshelt2@searshc.com
164
+ executables: []
165
+ extensions: []
166
+ extra_rdoc_files: []
167
+ files:
168
+ - ".gitignore"
169
+ - ".rspec"
170
+ - ".rubocop.yml"
171
+ - ".travis.yml"
172
+ - CODE_OF_CONDUCT.md
173
+ - Gemfile
174
+ - Guardfile
175
+ - LICENSE.txt
176
+ - README.md
177
+ - Rakefile
178
+ - bazaar_voice.gemspec
179
+ - bin/console
180
+ - bin/setup
181
+ - lib/bazaar_voice.rb
182
+ - lib/bazaar_voice/version.rb
183
+ homepage: https://github.com/deanshelton913/bazaar-voice
184
+ licenses:
185
+ - MIT
186
+ metadata: {}
187
+ post_install_message:
188
+ rdoc_options: []
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ requirements: []
202
+ rubyforge_project:
203
+ rubygems_version: 2.4.6
204
+ signing_key:
205
+ specification_version: 4
206
+ summary: A Ruby based Bazaar Voice API Wrapper
207
+ test_files: []