Module: SnowshoeRuby

Defined in:
lib/snowshoe_ruby.rb,
lib/snowshoe_ruby/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.clientObject



10
11
12
13
14
# File 'lib/snowshoe_ruby.rb', line 10

def client
  @@client ||= OAuth::Consumer.new( config["key"], config["secret"], 
    {:site => "http://beta.snowshoestamp.com/api", :scheme => :header}
  )
end

.configObject



6
7
8
# File 'lib/snowshoe_ruby.rb', line 6

def config
  @@config ||= YAML.load(open("#{Rails.root}/config/snowshoe.yml").read)[Rails.env]
end

.stamp(data) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/snowshoe_ruby.rb', line 20

def stamp(data)
  # Get Auth key with consumer
  @resp = client.request(:post, '/v2/stamp', nil, {}, data, { 'Content-Type' => 'application/x-www-form-urlencoded' })

  # Parse response and send to template
  @response = JSON.parse(@resp.body)
end

.stamp_urlObject



16
17
18
# File 'lib/snowshoe_ruby.rb', line 16

def stamp_url
  "http://beta.snowshoestamp.com/applications/client/#{config["key"]}/"
end