pamfaxr 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples/hello_pamfax.rb +33 -0
- data/lib/pamfaxr/multipart.rb +2 -1
- data/lib/pamfaxr/pamfaxr.rb +4 -5
- data/pamfaxr.gemspec +4 -2
- metadata +5 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Send faxes from the commandline
|
2
|
+
# USAGE: hello_pamfax.rb username password number [message]
|
3
|
+
require 'rubygems'
|
4
|
+
require 'lib/pamfaxr'
|
5
|
+
|
6
|
+
#Check commandline arguments
|
7
|
+
if 3 > ARGV.length || 4 < ARGV.length
|
8
|
+
abort('USAGE: hello_pamfax.rb username password number [message]')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Pass user name and password
|
12
|
+
pamfaxr = PamFaxr.new :username => ARGV[0],
|
13
|
+
:password => ARGV[1]
|
14
|
+
|
15
|
+
# Create a faxjob
|
16
|
+
faxjob = pamfaxr.create_fax_job
|
17
|
+
|
18
|
+
# Add cover and text
|
19
|
+
covers = pamfaxr.list_available_covers
|
20
|
+
pamfaxr.set_cover(covers['Covers']['content'][1]['id'], (4 == ARGV.length ? ARGV[3] : 'Hello, world'))
|
21
|
+
pamfaxr.add_recipient(ARGV[2])
|
22
|
+
|
23
|
+
# Loop until ready to send
|
24
|
+
loop do
|
25
|
+
fax_state = pamfaxr.get_state
|
26
|
+
converting = true
|
27
|
+
break if fax_state['FaxContainer']['state'] == 'ready_to_send'
|
28
|
+
sleep 15
|
29
|
+
end
|
30
|
+
|
31
|
+
# Send
|
32
|
+
pamfaxr.send_fax
|
33
|
+
|
data/lib/pamfaxr/multipart.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Cody Brimhall <mailto:cbrimhall@ucdavis.edu>
|
5
5
|
# Created:: 22 Feb 2008
|
6
|
+
# Licensed under the terms of the WTFPL
|
6
7
|
|
7
8
|
module Multipart
|
8
9
|
VERSION = "1.0.0" unless const_defined?(:VERSION)
|
@@ -72,4 +73,4 @@ module Multipart
|
|
72
73
|
"Content-Type: #{ mime_type.simplified }\r\n\r\n#{ content }\r\n"
|
73
74
|
end
|
74
75
|
end
|
75
|
-
end
|
76
|
+
end
|
data/lib/pamfaxr/pamfaxr.rb
CHANGED
@@ -688,7 +688,9 @@ class PamFaxr
|
|
688
688
|
# @return [Boolean] true if a file is still in the converting process
|
689
689
|
def converting?(fax_state)
|
690
690
|
converting = false
|
691
|
-
fax_state['Files']
|
691
|
+
if fax_state['Files'].include? 'content'
|
692
|
+
fax_state['Files']['content'].each { |file| converting = true if file['state'] == '' || file['state'] == 'converting' }
|
693
|
+
end
|
692
694
|
converting
|
693
695
|
end
|
694
696
|
|
@@ -733,9 +735,6 @@ class PamFaxr
|
|
733
735
|
# @option params [optional, String] :api_secret the PamFax API secret you have been assigned
|
734
736
|
#
|
735
737
|
# @return [Object] the instantiated FaxJob class
|
736
|
-
#
|
737
|
-
# @example create a new PamFax object
|
738
|
-
# pamfaxr = PamFax.new({ :key => 'your_api_key', :secret => 'your_api_secret' })
|
739
738
|
def initialize(options={})
|
740
739
|
base_uri = options[:base_uri] || "https://api.pamfax.biz"
|
741
740
|
api_key = options[:api_key] || "tropo_developer"
|
@@ -800,4 +799,4 @@ class PamFaxr
|
|
800
799
|
http.use_ssl = true
|
801
800
|
http
|
802
801
|
end
|
803
|
-
end
|
802
|
+
end
|
data/pamfaxr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pamfaxr}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jason Goecke"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-17}
|
13
13
|
s.description = %q{Ruby library for the FaxJob portion of the PamFax API.}
|
14
14
|
s.email = %q{jsgoecke@voxeo.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"VERSION",
|
26
26
|
"examples/Tropo.pdf",
|
27
27
|
"examples/example.rb",
|
28
|
+
"examples/hello_pamfax.rb",
|
28
29
|
"lib/pamfaxr.rb",
|
29
30
|
"lib/pamfaxr/multipart.rb",
|
30
31
|
"lib/pamfaxr/pamfaxr.rb",
|
@@ -41,6 +42,7 @@ Gem::Specification.new do |s|
|
|
41
42
|
s.summary = %q{Ruby library for the PamFax API.}
|
42
43
|
s.test_files = [
|
43
44
|
"examples/example.rb",
|
45
|
+
"examples/hello_pamfax.rb",
|
44
46
|
"spec/pamfaxr_spec.rb",
|
45
47
|
"spec/spec_helper.rb"
|
46
48
|
]
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jason Goecke
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-17 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- VERSION
|
114
114
|
- examples/Tropo.pdf
|
115
115
|
- examples/example.rb
|
116
|
+
- examples/hello_pamfax.rb
|
116
117
|
- lib/pamfaxr.rb
|
117
118
|
- lib/pamfaxr/multipart.rb
|
118
119
|
- lib/pamfaxr/pamfaxr.rb
|
@@ -153,5 +154,6 @@ specification_version: 3
|
|
153
154
|
summary: Ruby library for the PamFax API.
|
154
155
|
test_files:
|
155
156
|
- examples/example.rb
|
157
|
+
- examples/hello_pamfax.rb
|
156
158
|
- spec/pamfaxr_spec.rb
|
157
159
|
- spec/spec_helper.rb
|