hello_fax 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in hello_fax.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # HelloFax API
2
+
3
+ Register on [https://www.hellofax.com](https://www.hellofax.com) to obtain an account and GUID.
4
+
5
+ Due to an [outstanding issue](https://github.com/jwagener/httmultiparty/issues/10) with HTTMultiParty we can only send one document at a time.
6
+
7
+ HelloFax developer is allowing 10 files per request.
8
+ > I'm thinking that I'll limit the number of files to 10 and the total upload size to 30 MB and give an immediate, synchronous error for both these cases. I'll also limit faxes to a total of 200 pages and return an error in the callback (since I can't determine number of pages quickly enough to give a synchronous error).
9
+
10
+ The API documentation is not exposed anywhere but this wrapper consists of all the functionality the API has.
11
+
12
+ There are the two callback URLs, one for inbound and one for outbound, that can be set through `update_account_details`.
13
+
14
+ Then all you need to do is:
15
+
16
+ ```
17
+ $hello_fax = HelloFax::API.new("email@address.com", 'password', 'guid') # this belongs in an initializer
18
+ $hello_fax.send_fax('5555555555', File.new("file.pdf")).parsed_response
19
+ ```
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
data/hello_fax.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "hello_fax/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "hello_fax"
7
+ s.version = HelloFax::VERSION
8
+ s.authors = ["Ellis Berner"]
9
+ s.email = ["eberner@doximity.com"]
10
+ s.homepage = "https://github.com/maletor/hello_fax"
11
+ s.summary = %q{wrapper for HelloFax api}
12
+ s.description = %q{Uses HTTMultiParty for interfacing with HelloFax to send and receive faxes, buy fax lines and more.}
13
+
14
+ s.rubyforge_project = "hello_fax"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "httmultiparty", "~> 0.3.5"
22
+
23
+ s.add_development_dependency "rspec", "~> 2.6.0"
24
+ s.add_development_dependency "fakeweb", "~> 1.3.0"
25
+ end
data/lib/hello_fax.rb ADDED
@@ -0,0 +1,44 @@
1
+ require "hello_fax/version"
2
+ require "httmultiparty"
3
+
4
+ module HelloFax
5
+ class API
6
+
7
+ include ::HTTMultiParty
8
+
9
+ base_uri "https://www.hellofax.com/apiapp.php/v1/"
10
+ headers 'User-Agent' => "hello_fax gem #{VERSION}"
11
+
12
+ attr_accessor :guid
13
+
14
+ def initialize(username, password, guid)
15
+ self.class.basic_auth username, password
16
+ @guid = guid
17
+ end
18
+
19
+ def send_fax(to, file)
20
+ self.class.post("/Accounts/#{@guid}/Transmissions", :query => { :To => to, :file => file })
21
+ end
22
+
23
+ def account_details
24
+ self.class.get("/Accounts/#{@guid}")
25
+ end
26
+
27
+ def update_account_details(options)
28
+ self.class.put("/Accounts/#{@guid}", :query => options)
29
+ end
30
+
31
+ def transmissions
32
+ self.class.get("/Accounts/#{@guid}/Transmissions")
33
+ end
34
+
35
+ def fax_lines
36
+ self.class.get("/Accounts/#{@guid}/FaxLines")
37
+ end
38
+
39
+ def find_fax_numbers(state_code)
40
+ self.class.get('/AreaCodes', :query => { :StateCode => state_code })
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ module HelloFax
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,8 @@
1
+ describe HelloFax do
2
+ it "should post a fax"
3
+ it "should get account details"
4
+ it "should put account details"
5
+ it "should get current transmissions"
6
+ it "should get fax lines in use"
7
+ it "should get fax numbers available by state"
8
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hello_fax
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Ellis Berner
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-11 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httmultiparty
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 25
29
+ segments:
30
+ - 0
31
+ - 3
32
+ - 5
33
+ version: 0.3.5
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 23
45
+ segments:
46
+ - 2
47
+ - 6
48
+ - 0
49
+ version: 2.6.0
50
+ type: :development
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: fakeweb
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 27
61
+ segments:
62
+ - 1
63
+ - 3
64
+ - 0
65
+ version: 1.3.0
66
+ type: :development
67
+ version_requirements: *id003
68
+ description: Uses HTTMultiParty for interfacing with HelloFax to send and receive faxes, buy fax lines and more.
69
+ email:
70
+ - eberner@doximity.com
71
+ executables: []
72
+
73
+ extensions: []
74
+
75
+ extra_rdoc_files: []
76
+
77
+ files:
78
+ - .gitignore
79
+ - .rspec
80
+ - Gemfile
81
+ - README.md
82
+ - Rakefile
83
+ - hello_fax.gemspec
84
+ - lib/hello_fax.rb
85
+ - lib/hello_fax/version.rb
86
+ - spec/hello_fax_spec.rb
87
+ homepage: https://github.com/maletor/hello_fax
88
+ licenses: []
89
+
90
+ post_install_message:
91
+ rdoc_options: []
92
+
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ hash: 3
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ requirements: []
114
+
115
+ rubyforge_project: hello_fax
116
+ rubygems_version: 1.8.6
117
+ signing_key:
118
+ specification_version: 3
119
+ summary: wrapper for HelloFax api
120
+ test_files:
121
+ - spec/hello_fax_spec.rb