digitsend 0.0.9 → 0.0.10

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.
data/README.md CHANGED
@@ -1,29 +1,94 @@
1
- # Digitsend
1
+ # DigitSend
2
2
 
3
- TODO: Write a gem description
3
+ DigitSend is a secure email and file sharing service with a streamlined
4
+ two-factor registration process. This gem allows you to send email and upload
5
+ files to share programmatically.
4
6
 
5
- ## Installation
7
+ ## Usage
6
8
 
7
- Add this line to your application's Gemfile:
9
+ ### 1. API Key
8
10
 
9
- gem 'digitsend'
11
+ You must set the API key before performing any operations. API keys are
12
+ granted on a per-user basis using the administration portal. All operations
13
+ are done on behalf of the user to which the API key belongs.
10
14
 
11
- And then execute:
15
+ ```ruby
16
+ DigitSend::Config.api_token = 'bdf6a88dcb7e3ff3df18afda99591360'
17
+ ```
18
+
19
+ ### 2. Sending Messages
12
20
 
13
- $ bundle
21
+ The general approach:
14
22
 
15
- Or install it yourself as:
23
+ ```ruby
24
+ DigitSend::Message.send do |m|
25
+ m.to "bob@example.com", "3125551234"
26
+ m.to "tom@example.com", "7731112222"
27
+ m.cc "fred@example.com"
28
+ m.subject "Hello Bob, Tom, and Fred"
29
+ m.body "Here's a message, hope you enjoy!"
30
+ m.attach "report.xls"
31
+ m.attach "notes.txt", "here's the contents of notes.txt"
32
+ end
33
+ ```
16
34
 
17
- $ gem install digitsend
35
+ A few things to note:
18
36
 
19
- ## Usage
37
+ * Call to or cc multiple times to add multiple recipients.
38
+ * The second (optional) argument to the to and cc methods is that user's phone
39
+ number. The phone number is required if this is the first message being sent
40
+ to the user.
41
+
42
+ ### 3. DigitSend::MissingPhoneNumbers
43
+
44
+ This exception is thrown whenever an attempt is made to send a message to a new
45
+ user without providing a phone number:
46
+
47
+ ```ruby
48
+ begin
49
+ DigitSend::Message.send do |m|
50
+ m.to "bob@example.com"
51
+ m.subject "Testing"
52
+ m.body "Here's a test mesage"
53
+ end
54
+ rescue DigitSend::MissingPhoneNumbers => ex
55
+ puts "need phone numbers for: #{ex.email_addresses}"
56
+ end
57
+ ```
58
+
59
+ ### 4. Message File Attachments
60
+
61
+ The attach method can be called a number of ways:
62
+
63
+ ```ruby
64
+ DigitSend::Message.send do |m|
65
+ m.to "bob@example.com"
66
+ m.subject "Here's some attachments"
67
+
68
+ # Attach the report.xls file on disk.
69
+ m.attach "/path/to/report.xls"
70
+
71
+ # Attach a file with its contents specified as a string.
72
+ m.attach "reports.txt", "contents of the file"
73
+
74
+ # Attach a file with its contents specified as any object
75
+ # that can be passed to UploadIO.new.
76
+ m.attach "picture.jpg", File.open("picture.jpg")
77
+ end
78
+ ```
79
+
80
+ ### 5. Uploading Files to Repositories
20
81
 
21
- TODO: Write usage instructions here
82
+ Repositories are referenced by name and must be created in using the admin
83
+ portal.
22
84
 
23
- ## Contributing
85
+ ```ruby
86
+ DigitSend::Repository.upload "Reports", "/Internal/#{Date.today}", "activity.csv"
87
+ ```
24
88
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Added some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
89
+ * The first parameter is the name of the repository.
90
+ * The second parameter identifies the folder to which the file should belong. Folders are created on the fly, mkdir_p style.
91
+ * The third parameter is the name of the file.
92
+ * The optional fourth parameter can can be the string contents of the file or
93
+ an object; it has the same behavior as with message attachments described
94
+ above.
@@ -1,6 +1,6 @@
1
1
  module DigitSend
2
2
  class Repository
3
- def self.upload(repo_name, path, filename, data)
3
+ def self.upload(repo_name, path, filename, data = nil)
4
4
  uuid = Client.upload_s3_file(filename, data)
5
5
 
6
6
  Client.call '/files/versions',
@@ -1,3 +1,3 @@
1
1
  module DigitSend
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digitsend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: