snowshoe 2.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a07ff9e9a55e53f98d578f2788f56ba02e922ef1
4
+ data.tar.gz: 109b0185e8521586f708bd1b85ce59ea7c10b25f
5
+ SHA512:
6
+ metadata.gz: 0f2e50575afce85c6d49ce797f5021a283585c645d4941b4f168c6dcce4d9bc38f2f46855daf008c6c8fa876bfe138b4f30219954ccd012731834afe72a4318c
7
+ data.tar.gz: d56acc52ac5b87ad4218093bb14473d8f0917cabb38b4e3862045ce3dbdebc9e256faabaa013786064988d686d18e2a182059de36c93acf3d58ed7b0e1cdfe6a
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *gem
@@ -0,0 +1,5 @@
1
+ == 2.0.0
2
+ * Spring 2015 Release
3
+
4
+ == 1.0.0
5
+ * TechStars Disney Release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Snowshoe
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,70 @@
1
+ Snowshoe API Ruby Client
2
+ ============
3
+
4
+ The Snowshoe ruby client submits point data to the Snowshoe API for authentication. The client will return a JSON parsed hash, containing either the serial of the matched stamp (a success!) or an error.
5
+
6
+ ## Dependencies
7
+ - oauth
8
+
9
+ ## Installation
10
+ ```ruby
11
+ gem install snowshoe
12
+ ```
13
+
14
+
15
+ ## Usage: Setting up the client and making a POST
16
+
17
+ On instantiation of the Snowshoe client, pass in your SNOWSHOE_APP_KEY & SNOWSHOE_APP_SECRET, respectively.
18
+
19
+ Currently, all posts are made to v2 of the API at http://beta.snowshoestamp.com/v2/stamp.
20
+
21
+ The data hash is constructed from the point data sent by your front-end stamp screen.
22
+
23
+ The client will return a JSON parsed hash, containing either the serial of the matched stamp (a success!) or an error.
24
+
25
+ ```ruby
26
+ client = Snowshoe::Client.new(SNOWSHOE_APP_KEY, SNOWSHOE_APP_SECRET)
27
+ data = { "data" => params["data"] }
28
+ response = client.post(data)
29
+
30
+ if response.include? "stamp"
31
+ # Serve success asset...
32
+ else
33
+ # Handle errors...
34
+ end
35
+ ```
36
+
37
+ Below are examples of success and error JSON responses from the API.
38
+
39
+ ```javascript
40
+ // Success
41
+ {
42
+ "stamp": {
43
+ "serial": "DEV-STAMP"
44
+ },
45
+ "receipt": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
46
+ "secure": false,
47
+ "created": "2015-03-24 11:27:33.014149"
48
+ }
49
+
50
+ // Error
51
+ {
52
+ "error": {
53
+ "message": "Stamp not found",
54
+ "code": 32
55
+ },
56
+ "receipt": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
57
+ "secure": false,
58
+ "created": "2015-03-24 11:27:48.235046"
59
+ }
60
+ ```
61
+
62
+ ## Tests
63
+ (Coming soon)
64
+
65
+
66
+ ## Contribute
67
+ Join us in improving this client by making a pull request.
68
+
69
+ ## License
70
+ MIT (see LICENSE file)
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'test'
7
+ end
8
+
9
+ desc "Run tests"
10
+ task :default => :test
@@ -0,0 +1,5 @@
1
+ require "oauth"
2
+ require "json"
3
+
4
+ require "snowshoe/client"
5
+ require "snowshoe/version"
@@ -0,0 +1,39 @@
1
+ module Snowshoe
2
+ class Client
3
+ API_VERSION = "http://beta.snowshoestamp.com/api/v2"
4
+
5
+ def initialize(key, secret, options={})
6
+ # Flexiblity for future endpoint uri changes
7
+ api_version = options[:api_version] || API_VERSION
8
+
9
+ @consumer = OAuth::Consumer.new(
10
+ key,
11
+ secret,
12
+ {:site => api_version,
13
+ :scheme => :header
14
+ }
15
+ )
16
+ end
17
+
18
+ def post(body)
19
+ response = consumer.request(:post,
20
+ "/stamp",
21
+ nil,
22
+ {},
23
+ body,
24
+ {'Content-Type' => 'application/x-www-form-urlencoded'}
25
+ )
26
+ return JSON.parse(response.body)
27
+ rescue => exception
28
+ log_error(exception.message)
29
+ []
30
+ end
31
+
32
+ def log_error(message)
33
+ puts "ERROR: #{self.class}: #{message}"
34
+ end
35
+
36
+ private
37
+ attr_reader :consumer
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module Snowshoe
2
+ VERSION = "2.0.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'snowshoe/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "snowshoe"
8
+ spec.version = Snowshoe::VERSION
9
+ spec.summary = %q{Ruby API Client for Snowshoe}
10
+ spec.description = %q{Authenticate stamps from the Snowshoe API}
11
+ spec.license = "MIT"
12
+ spec.authors = ["Snowshoe","Iggy Igner", "Philipe Navarro"]
13
+ spec.email = ["techteam@snowshoestamp.com"]
14
+ spec.homepage = "http://snowshoestamp.com"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_runtime_dependency 'oauth', '>= 0.4'
24
+ end
@@ -0,0 +1 @@
1
+ # Coming soon.
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snowshoe
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Snowshoe
8
+ - Iggy Igner
9
+ - Philipe Navarro
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-03-24 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.6'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.6'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '10.0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '10.0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: oauth
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0.4'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0.4'
57
+ description: Authenticate stamps from the Snowshoe API
58
+ email:
59
+ - techteam@snowshoestamp.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - CHANGELOG.rdoc
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - lib/snowshoe.rb
71
+ - lib/snowshoe/client.rb
72
+ - lib/snowshoe/version.rb
73
+ - snowshoe.gemspec
74
+ - test/client_test.rb
75
+ homepage: http://snowshoestamp.com
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.2.3
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Ruby API Client for Snowshoe
99
+ test_files:
100
+ - test/client_test.rb