hello_fax 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  Register on [https://www.hellofax.com](https://www.hellofax.com) to obtain an account and GUID.
4
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
5
  HelloFax developer is allowing 10 files per request.
6
+
8
7
  > 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
8
 
10
9
  The API documentation is not exposed anywhere but this wrapper consists of all the functionality the API has.
@@ -15,5 +14,91 @@ Then all you need to do is:
15
14
 
16
15
  ```
17
16
  $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
17
+ $hello_fax.send_fax('555123456', File.new("file.pdf"))
18
+ ```
19
+
20
+ This returns an HTTPary::Response object which you can call `#parsed_response` on to convert the JSON in the reponse to Ruby.
21
+
22
+ # Walkthrough
23
+
24
+ Sign up for a paid account at https://www.hellofax.com/info/pricing
25
+
26
+ Go to https://www.hellofax.com/account/apiInfo and take note of your Account GUID. You'll need this for most API requests.
27
+
28
+ Make your first API request and get your account's configuration info. Make sure to URI encode.
29
+
30
+ ```
31
+ curl "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]"
32
+ ```
33
+
34
+ The response will be a JSON representation of the account settings of yours.
35
+
36
+ Let's turn off email notifications (for outbound and inbound faxes) for your account by making a POST:
37
+
38
+ ```
39
+ curl -d "ShouldSendConfEmails=false" "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]"
40
+ ```
41
+
42
+ Let's add callback URLs for your inbound and outbound faxes (again, with a POST):
43
+
44
+ ```
45
+ curl -d "AreaCode=415" "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]/FaxLines"
46
+ ```
47
+
48
+ Let's see what fax lines we have at our disposal:
49
+
50
+ ```
51
+ curl "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]/FaxLines"
52
+ ```
53
+
54
+ The response should contain the FaxLine you selected when signing up for a premium subscription.
55
+
56
+ Let's purchase a fax number. First, we need to see what area codes are available in our state (not all area codes are available) with a GET:
57
+
19
58
  ```
59
+ curl "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/AreaCodes?StateCode=CA"
60
+ ```
61
+
62
+ Purchase a fax line from one of the available area codes in step 7
63
+
64
+ ```
65
+ curl -d "AreaCode=[area code from step 7]" "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]/FaxLines"
66
+ ```
67
+
68
+ Now let's actually send a fax! Right now the API can only handle one file at a time:
69
+
70
+ ```
71
+ curl -F file=@fax.html "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]/Transmissions?To=5555555555"
72
+ ```
73
+
74
+ This will begin the process of sending the fax. Just because you get a 200 HTTP response to this call does not mean that the fax will go through or even be sent (a file conversion error could occur). However, once the fax's StatusCode becomes E (for Error) or S (for Success) you will get a POST back to the callback URL you specified in step #5.
75
+
76
+ Possible StatusCode values:
77
+
78
+ ```
79
+ T = transmitting/sending
80
+ P = pending/converting
81
+ S = successfully sent
82
+ E = error; failed to convert or to send fully
83
+ H = on hold. You shouldn't ever see this but if you do, treat it as an error.
84
+ ```
85
+
86
+ NOTE: The CallerID on all the faxes will show up as "Restricted" or "Unknown" to the recipient
87
+
88
+ Check the status of the fax you initiated in step #9:
89
+
90
+ ```
91
+ curl "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]/Transmissions/[Transmission GUID]"
92
+ ```
93
+
94
+ The Transmission GUID can be found in the JSON response returned from the API call in step #6. If you wamt, you can check the status of all your Transmissions by omitting the Transmission GUID:
95
+
96
+ ```
97
+ curl "https://[joseph%40hellofax.com]:[fakepassword]@www.hellofax.com/apiapp.php/v1/Accounts/[Your Account GUID]/Transmissions"
98
+ ```
99
+
100
+ Note that these results are paged. You can get different pages by specifying the Page and PageSize url parameters. See the FirstPageUri, NextPageUri, PreviousPageUri, and LastPageUri response elements to get a better idea of how the paging works.
101
+
102
+ After the status code of the fax gets set to S or E you'll also want to verify that your outbound fax callback URL was hit. It should receive a POST with a parameter called 'json' that contains everything you'd get in the response to a call like you made in step #10.
103
+
104
+ If you happened to send the fax to your own fax number (silly in real life, but useful for testing), you should also verify that your inbound fax callback URL was hit as well.
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency "httmultiparty", "~> 0.3.5"
21
+ s.add_dependency "httmultiparty", "~> 0.3"
22
22
 
23
23
  s.add_development_dependency "rspec", "~> 2.6.0"
24
24
  s.add_development_dependency "fakeweb", "~> 1.3.0"
@@ -1,3 +1,3 @@
1
1
  module HelloFax
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,80 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hello_fax
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ellis Berner
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-11 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: httmultiparty
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 25
29
- segments:
30
- - 0
31
- - 3
32
- - 5
33
- version: 0.3.5
20
+ - !ruby/object:Gem::Version
21
+ version: '0.3'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
40
25
  none: false
41
- requirements:
26
+ requirements:
42
27
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 23
45
- segments:
46
- - 2
47
- - 6
48
- - 0
28
+ - !ruby/object:Gem::Version
29
+ version: '0.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
49
37
  version: 2.6.0
50
38
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: fakeweb
54
39
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.6.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: fakeweb
48
+ requirement: !ruby/object:Gem::Requirement
56
49
  none: false
57
- requirements:
50
+ requirements:
58
51
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 27
61
- segments:
62
- - 1
63
- - 3
64
- - 0
52
+ - !ruby/object:Gem::Version
65
53
  version: 1.3.0
66
54
  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:
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.0
62
+ description: Uses HTTMultiParty for interfacing with HelloFax to send and receive
63
+ faxes, buy fax lines and more.
64
+ email:
70
65
  - eberner@doximity.com
71
66
  executables: []
72
-
73
67
  extensions: []
74
-
75
68
  extra_rdoc_files: []
76
-
77
- files:
69
+ files:
78
70
  - .gitignore
79
71
  - .rspec
80
72
  - Gemfile
@@ -86,36 +78,28 @@ files:
86
78
  - spec/hello_fax_spec.rb
87
79
  homepage: https://github.com/maletor/hello_fax
88
80
  licenses: []
89
-
90
81
  post_install_message:
91
82
  rdoc_options: []
92
-
93
- require_paths:
83
+ require_paths:
94
84
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
85
+ required_ruby_version: !ruby/object:Gem::Requirement
96
86
  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
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
92
  none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 3
110
- segments:
111
- - 0
112
- version: "0"
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
113
97
  requirements: []
114
-
115
98
  rubyforge_project: hello_fax
116
- rubygems_version: 1.8.6
99
+ rubygems_version: 1.8.23
117
100
  signing_key:
118
101
  specification_version: 3
119
102
  summary: wrapper for HelloFax api
120
- test_files:
103
+ test_files:
121
104
  - spec/hello_fax_spec.rb
105
+ has_rdoc: