snowshoe_ruby 0.0.2.beta → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00dabdcf3fafd25816d94ca0fbf02d51c1fcfbb5
4
- data.tar.gz: 4b51e80ff0a1083105a60b01ac9e8f8e52b6583b
3
+ metadata.gz: 3592c40cdc9bc254bae46a1f957c0d185eae2e7e
4
+ data.tar.gz: 004301952e3a593cb66bf41d45540e80cf93ef85
5
5
  SHA512:
6
- metadata.gz: 932b5fd62369f9ace408cca39974ce8da13a16515a2e5405343cda7486b4207ca6f98d633a54ad681bd71e8a2122971794aa6f04298a2165e56f8ad87a290344
7
- data.tar.gz: d86f623cc7dd7a8ff5b8a1f760127c5bf47b5def9c26b3f3b981e0dd59c2cab1cb9abcd1a255f1dd70d192229e931d4479734db92def6b1db37843c79d9255e1
6
+ metadata.gz: 18d07e70183c530cd3cb0d2eec3f3f81bbdd08bb5f98c81e5f2a34ac0acfd2a852d1cb7cc87944f0db082ec5c48dd44b0430865642b1a5c087d9e9173b2d69f6
7
+ data.tar.gz: 70207ac47ba4f6102d5fcf5f49bb0b7b8964507c019204a11a2685e61e55c14ec01021fa7cf77373d5fdd631b209ca98e978a332b9906289f5e9d718293be49f
data/README.md CHANGED
@@ -20,7 +20,18 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ config/snowshoe.yml
24
+
25
+ development:
26
+ secret: yoursecret
27
+ key: yourkey
28
+ callback_url: http://yourdomain.com/showshoe
29
+
30
+ In your callback controller
31
+
32
+ SnowshoeRuby.stamp(params)
33
+ # or
34
+ redirect_to SnowshoeRuby.stamp_url
24
35
 
25
36
  ## Contributing
26
37
 
@@ -1,22 +1,29 @@
1
1
  require "snowshoe_ruby/version"
2
- require "snowshoe_ruby/client"
3
- require "snowshoe_ruby/config"
4
2
 
5
3
  module SnowshoeRuby
6
- client = Client.new(APP_KEY, APP_SECRET)
4
+ class << self
7
5
 
8
- @callback_url = CALLBACK_URL
9
- @data = {"data" => params["data"]}
6
+ def config
7
+ @@config ||= YAML.load(open("#{Rails.root}/config/snowshoe.yml").read)[Rails.env]
8
+ end
10
9
 
11
- @consumer = OAuth::Consumer.new(
12
- client.app_key,
13
- client.app_secret,
14
- {:site => "http://beta.snowshoestamp.com/api",
15
- :scheme => :header
16
- })
17
- # Get Auth key with consumer
18
- @resp = @consumer.request(:post, '/v2/stamp', nil, {}, @data, { 'Content-Type' => 'application/x-www-form-urlencoded' })
10
+ def client
11
+ @@client ||= OAuth::Consumer.new( config["key"], config["secret"],
12
+ {:site => "http://beta.snowshoestamp.com/api", :scheme => :header}
13
+ )
14
+ end
19
15
 
20
- # Parse response and send to template
21
- @response = JSON.parse(@resp.body)
16
+ def stamp_url
17
+ "http://beta.snowshoestamp.com/applications/client/#{config["key"]}/"
18
+ end
19
+
20
+ def stamp(data)
21
+ # Get Auth key with consumer
22
+ @resp = client.request(:post, '/v2/stamp', nil, {}, data, { 'Content-Type' => 'application/x-www-form-urlencoded' })
23
+
24
+ # Parse response and send to template
25
+ @response = JSON.parse(@resp.body)
26
+ end
27
+
28
+ end
22
29
  end
@@ -1,3 +1,3 @@
1
1
  module SnowshoeRuby
2
- VERSION = "0.0.2.beta"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snowshoe_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.beta
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - IggyIgner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-29 00:00:00.000000000 Z
12
+ date: 2014-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
@@ -83,9 +83,9 @@ files:
83
83
  - README.md
84
84
  - Rakefile
85
85
  - lib/snowshoe_ruby.rb
86
- - lib/snowshoe_ruby/client.rb
87
- - lib/snowshoe_ruby/config.rb
88
86
  - lib/snowshoe_ruby/version.rb
87
+ - snowshoe_ruby-0.0.1.beta.gem
88
+ - snowshoe_ruby-0.0.2.beta.gem
89
89
  - snowshoe_ruby.gemspec
90
90
  - spec/snowshoe_ruby_spec.rb
91
91
  - spec/spec_helper.rb
@@ -106,9 +106,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 1.3.1
111
+ version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
114
  rubygems_version: 2.2.2
@@ -1,12 +0,0 @@
1
- class Client
2
- attr_reader :base_url, :app_key, :app_secret
3
-
4
- def initialize(app_key, app_secret)
5
- @base_url = "http://beta.snowshoestamp.com/api/v2/"
6
-
7
- # Instance variables
8
- @app_key = app_key
9
- @app_secret = app_secret
10
- end
11
-
12
- end
@@ -1,3 +0,0 @@
1
- APP_KEY = '5bc9c3ddf1f46265e03a'
2
- APP_SECRET = '70a99aa7f4de7f48f235215ce2708b6e4f19377c'
3
- CALLBACK_URL = 'http://10.99.114.161/:3000/stamp_info'