signatureio 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -39,12 +39,17 @@ Replace the url with a url of the PDF or Microsoft Word file you choose.
39
39
 
40
40
  $ Signatureio::Document.all
41
41
 
42
+ ### List Events
43
+
44
+ $ Signatureio::Event.all
45
+ $ Signatureio::Event.all({count: 1, offset: 1, type: "document.created"})
46
+
42
47
  ## Contributing
43
48
 
44
49
  1. Fork it
45
50
  2. Create your feature branch (`git checkout -b my-new-feature`)
46
- 3. export SIGNATURE_SECRET_API_KEY="your_secret_api_key"
47
- 4. export SIGNATURE_PUBLIC_API_KEY="your_public_api_key"
51
+ 3. export SIGNATURE_SECRET_API_KEY="your_test_secret_api_key"
52
+ 4. export SIGNATURE_PUBLIC_API_KEY="your_test_public_api_key"
48
53
  5. Commit your changes (`git commit -am 'Add some feature'`)
49
54
  6. Push to the branch (`git push origin my-new-feature`)
50
55
  7. Create new Pull Request
@@ -0,0 +1,17 @@
1
+ module Signatureio
2
+ class Event
3
+ #
4
+ # Api calls
5
+ #
6
+ def self.all(options={})
7
+ url = ["events.json?"]
8
+ url << "type=#{options[:type]}" if options[:type]
9
+ url << "count=#{options[:count]}" if options[:count]
10
+ url << "offset=#{options[:offset]}" if options[:offset]
11
+
12
+ url = url.join("&")
13
+ response = Signatureio.request.get url
14
+ RecursiveOpenStruct.new(response.body, :recurse_over_arrays => true)
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Signatureio
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/signatureio.rb CHANGED
@@ -3,6 +3,7 @@ require "faraday_middleware"
3
3
  require "recursive-open-struct"
4
4
  require "signatureio/version"
5
5
  require "signatureio/document"
6
+ require "signatureio/event"
6
7
 
7
8
  module Signatureio
8
9
  extend self
@@ -34,7 +34,7 @@ describe Signatureio::Document do
34
34
 
35
35
  context "correct secret api key" do
36
36
  before do
37
- Signatureio.secret_api_key = nil
37
+ Signatureio.secret_api_key = ENV['SIGNATURE_SECRET_API_KEY']
38
38
  end
39
39
 
40
40
  describe ".create" do
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ describe Signatureio::Event do
4
+ let(:subject) { Signatureio::Event }
5
+ let(:url) { "https://www.signature.io/pdfs/sign-below.pdf" }
6
+
7
+ context "incorrect secret api key" do
8
+ before do
9
+ Signatureio.secret_api_key = "incorrect_secret_api_key"
10
+ end
11
+
12
+ describe "attempt .all" do
13
+ before do
14
+ @response = subject.all
15
+ end
16
+
17
+ it do
18
+ @response.success.should be_false
19
+ @response.error.message.should_not be_empty
20
+ end
21
+ end
22
+ end
23
+
24
+ context "correct secret api key" do
25
+ before do
26
+ Signatureio.secret_api_key = ENV['SIGNATURE_SECRET_API_KEY']
27
+ end
28
+
29
+ describe ".all" do
30
+ before do
31
+ @response = subject.all(options)
32
+ end
33
+
34
+ context "default" do
35
+ let(:options) { {} }
36
+
37
+ it do
38
+ @response.success.should be_true
39
+ @response.events.count.should >= 1
40
+ end
41
+ end
42
+
43
+ context "count of 1" do
44
+ let(:options) { {count: 1} }
45
+
46
+ it do
47
+ @response.success.should be_true
48
+ @response.events.count.should == 1
49
+ end
50
+ end
51
+
52
+ context "type" do
53
+ let(:options) { {type: "nonexistant.type"} }
54
+
55
+ it do
56
+ @response.success.should be_true
57
+ @response.events.count.should == 0
58
+ end
59
+ end
60
+
61
+ context "offset" do
62
+ let(:options) { {offset: 3} }
63
+
64
+ it do
65
+ @response.success.should be_true
66
+ @response.offset.should eq 3
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Signatureio do
4
- it { Signatureio::VERSION.should eq "0.0.5" }
4
+ it { Signatureio::VERSION.should eq "0.0.6" }
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signatureio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
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: 2013-04-12 00:00:00.000000000 Z
12
+ date: 2013-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -122,9 +122,11 @@ files:
122
122
  - Rakefile
123
123
  - lib/signatureio.rb
124
124
  - lib/signatureio/document.rb
125
+ - lib/signatureio/event.rb
125
126
  - lib/signatureio/version.rb
126
127
  - signatureio.gemspec
127
128
  - spec/signatureio/document_spec.rb
129
+ - spec/signatureio/event_spec.rb
128
130
  - spec/signatureio/version_spec.rb
129
131
  - spec/signatureio_spec.rb
130
132
  - spec/spec_helper.rb
@@ -142,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
144
  version: '0'
143
145
  segments:
144
146
  - 0
145
- hash: -1445965729381535831
147
+ hash: -2307663304026184963
146
148
  required_rubygems_version: !ruby/object:Gem::Requirement
147
149
  none: false
148
150
  requirements:
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
153
  version: '0'
152
154
  segments:
153
155
  - 0
154
- hash: -1445965729381535831
156
+ hash: -2307663304026184963
155
157
  requirements: []
156
158
  rubyforge_project:
157
159
  rubygems_version: 1.8.23
@@ -161,6 +163,7 @@ summary: Signature.io is the easiest way to create signable documents online. Se
161
163
  https://www.signature.io for details.
162
164
  test_files:
163
165
  - spec/signatureio/document_spec.rb
166
+ - spec/signatureio/event_spec.rb
164
167
  - spec/signatureio/version_spec.rb
165
168
  - spec/signatureio_spec.rb
166
169
  - spec/spec_helper.rb