zipmark 0.0.1.beta.5 → 0.0.1.beta.6

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.
@@ -67,8 +67,8 @@ module Zipmark
67
67
 
68
68
  def validate_authorization
69
69
  string_to_sign = ["POST",hashed_content,'application/json',date.rfc2822,uri,application_identifier].join("\n")
70
- signed_string = Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret, string_to_sign))
71
- valid_authorization = "ZM #{Base64.strict_encode64(identifier)}:#{signed_string}"
70
+ signed_string = Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret, string_to_sign)).chomp
71
+ valid_authorization = "ZM #{Base64.strict_encode64(identifier).chomp}:#{signed_string}"
72
72
  if authorization_header == valid_authorization
73
73
  return true
74
74
  else
@@ -10,6 +10,12 @@ module Zipmark
10
10
  # Public: Gets the Adapter.
11
11
  attr_reader :adapter
12
12
 
13
+ begin
14
+ require 'json'
15
+ rescue LoadError => e
16
+ puts 'You must have a json library installed to use Zipmark'
17
+ end
18
+
13
19
  # Public: Initialize a Zipmark Client
14
20
  #
15
21
  # options - Hash options used to configure the Client (default: {})
@@ -14,6 +14,10 @@ module Zipmark
14
14
  "<Entity:#{object_id} #{attributes.inspect}>"
15
15
  end
16
16
 
17
+ def id
18
+ attributes["id"]
19
+ end
20
+
17
21
  def method_missing(meth, *args, &block)
18
22
  if meth =~ /=$/
19
23
  dirty_attributes[meth.to_s.sub(/=$/, '')] = args.first
@@ -1,5 +1,3 @@
1
- require 'json'
2
-
3
1
  module Zipmark
4
2
  class Iterator
5
3
  attr_accessor :current_item, :json, :options
@@ -14,3 +14,11 @@ module Zipmark
14
14
  end
15
15
  end
16
16
  end
17
+
18
+ unless Base64.respond_to?(:strict_encode64)
19
+ module Base64
20
+ def strict_encode64(bin)
21
+ [bin].pack("m0")
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Zipmark
2
- VERSION = '0.0.1.beta.5'
2
+ VERSION = '0.0.1.beta.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta.5
4
+ version: 0.0.1.beta.6
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Simple Client Library to connect to the Zipmark API
15
15
  email: jake@zipmark.com