psm 0.1.0 → 0.1.2
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/Rakefile +17 -0
 - data/VERSION +1 -1
 - data/lib/psm.rb +2 -2
 - data/lib/psm/session.rb +2 -2
 - data/psm.gemspec +65 -0
 - metadata +6 -4
 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            begin
         
     | 
| 
      
 2 
     | 
    
         
            +
              require 'jeweler'
         
     | 
| 
      
 3 
     | 
    
         
            +
              Jeweler::Tasks.new do |gemspec|
         
     | 
| 
      
 4 
     | 
    
         
            +
                gemspec.name = "psm"
         
     | 
| 
      
 5 
     | 
    
         
            +
                gemspec.summary = "Client library for Print Stuff Mail, the snail mail webservice."
         
     | 
| 
      
 6 
     | 
    
         
            +
                gemspec.description = "Print Stuff Mail provides an RESTful API for sending snail mail. This library eases interfacing with it."
         
     | 
| 
      
 7 
     | 
    
         
            +
                gemspec.email = "psm@copypastel.com"
         
     | 
| 
      
 8 
     | 
    
         
            +
                gemspec.homepage = "http://github.com/copypastel/print_stuff_mail"
         
     | 
| 
      
 9 
     | 
    
         
            +
                gemspec.authors = ["ecin", "daicoden"]
         
     | 
| 
      
 10 
     | 
    
         
            +
                gemspec.add_dependency "addressable", ">= 2.1.1"
         
     | 
| 
      
 11 
     | 
    
         
            +
                gemspec.add_dependency "json", ">= 1.2.3"
         
     | 
| 
      
 12 
     | 
    
         
            +
                gemspec.add_development_dependency "shoulda", ">= 2.10.3"
         
     | 
| 
      
 13 
     | 
    
         
            +
                gemspec.add_development_dependency "artifice", ">= 0.5"
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 16 
     | 
    
         
            +
              puts "Jeweler not available. Install it with: gem install jeweler"
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.1. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.1.2
         
     | 
    
        data/lib/psm.rb
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ require 'json' 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            module PrintStuffMail
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              BASE_URL = 's.copypastel.com 
     | 
| 
      
 10 
     | 
    
         
            +
              BASE_URL = 's.copypastel.com' unless defined?(BASE_URL)
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              class Confirmation
         
     | 
| 
       13 
13 
     | 
    
         
             
                def initialize; @confirmed = false end
         
     | 
| 
         @@ -37,7 +37,7 @@ module PrintStuffMail 
     | 
|
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                def post_letter(message, address, return_address = nil)
         
     | 
| 
       39 
39 
     | 
    
         
             
                  uri = Addressable::URI.new  :host => PSM::BASE_URL,
         
     | 
| 
       40 
     | 
    
         
            -
                                              :path => '/letters/print'
         
     | 
| 
      
 40 
     | 
    
         
            +
                                              :path => '/psm/letters/print'
         
     | 
| 
       41 
41 
     | 
    
         
             
                  params = { :message => message, :address => address, 
         
     | 
| 
       42 
42 
     | 
    
         
             
                             :return_address => return_address,
         
     | 
| 
       43 
43 
     | 
    
         
             
                             :session => @session.id }
         
     | 
    
        data/lib/psm/session.rb
    CHANGED
    
    | 
         @@ -6,7 +6,7 @@ require 'json' 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            module PrintStuffMail
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              BASE_URL = 's.copypastel.com 
     | 
| 
      
 9 
     | 
    
         
            +
              BASE_URL = 's.copypastel.com' unless defined?(BASE_URL)
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              class Session
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
         @@ -45,7 +45,7 @@ module PrintStuffMail 
     | 
|
| 
       45 
45 
     | 
    
         
             
                  query = "account_id=#{@account_id}"
         
     | 
| 
       46 
46 
     | 
    
         
             
                  begin
         
     | 
| 
       47 
47 
     | 
    
         
             
                    response = Net::HTTP.start(PrintStuffMail::BASE_URL,80) do |http|
         
     | 
| 
       48 
     | 
    
         
            -
                      http.post("/sessions", query)
         
     | 
| 
      
 48 
     | 
    
         
            +
                      http.post("/psm/sessions", query)
         
     | 
| 
       49 
49 
     | 
    
         
             
                    end
         
     | 
| 
       50 
50 
     | 
    
         
             
                    JSON.parse(response.body)
         
     | 
| 
       51 
51 
     | 
    
         
             
                  rescue
         
     | 
    
        data/psm.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Generated by jeweler
         
     | 
| 
      
 2 
     | 
    
         
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         
     | 
| 
      
 3 
     | 
    
         
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         
     | 
| 
      
 4 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.name = %q{psm}
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.1.2"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.authors = ["ecin", "daicoden"]
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-04-28}
         
     | 
| 
      
 13 
     | 
    
         
            +
              s.description = %q{Print Stuff Mail provides an RESTful API for sending snail mail. This library eases interfacing with it.}
         
     | 
| 
      
 14 
     | 
    
         
            +
              s.email = %q{psm@copypastel.com}
         
     | 
| 
      
 15 
     | 
    
         
            +
              s.extra_rdoc_files = [
         
     | 
| 
      
 16 
     | 
    
         
            +
                "README.textile"
         
     | 
| 
      
 17 
     | 
    
         
            +
              ]
         
     | 
| 
      
 18 
     | 
    
         
            +
              s.files = [
         
     | 
| 
      
 19 
     | 
    
         
            +
                ".gitignore",
         
     | 
| 
      
 20 
     | 
    
         
            +
                 "README.textile",
         
     | 
| 
      
 21 
     | 
    
         
            +
                 "Rakefile",
         
     | 
| 
      
 22 
     | 
    
         
            +
                 "VERSION",
         
     | 
| 
      
 23 
     | 
    
         
            +
                 "lib/psm.rb",
         
     | 
| 
      
 24 
     | 
    
         
            +
                 "lib/psm/session.rb",
         
     | 
| 
      
 25 
     | 
    
         
            +
                 "psm.gemspec",
         
     | 
| 
      
 26 
     | 
    
         
            +
                 "test/fake_service.rb",
         
     | 
| 
      
 27 
     | 
    
         
            +
                 "test/psm/session_test.rb",
         
     | 
| 
      
 28 
     | 
    
         
            +
                 "test/psm_test.rb",
         
     | 
| 
      
 29 
     | 
    
         
            +
                 "test/test_helper.rb"
         
     | 
| 
      
 30 
     | 
    
         
            +
              ]
         
     | 
| 
      
 31 
     | 
    
         
            +
              s.homepage = %q{http://github.com/copypastel/print_stuff_mail}
         
     | 
| 
      
 32 
     | 
    
         
            +
              s.rdoc_options = ["--charset=UTF-8"]
         
     | 
| 
      
 33 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 34 
     | 
    
         
            +
              s.rubygems_version = %q{1.3.6}
         
     | 
| 
      
 35 
     | 
    
         
            +
              s.summary = %q{Client library for Print Stuff Mail, the snail mail webservice.}
         
     | 
| 
      
 36 
     | 
    
         
            +
              s.test_files = [
         
     | 
| 
      
 37 
     | 
    
         
            +
                "test/fake_service.rb",
         
     | 
| 
      
 38 
     | 
    
         
            +
                 "test/psm/session_test.rb",
         
     | 
| 
      
 39 
     | 
    
         
            +
                 "test/psm_test.rb",
         
     | 
| 
      
 40 
     | 
    
         
            +
                 "test/test_helper.rb"
         
     | 
| 
      
 41 
     | 
    
         
            +
              ]
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              if s.respond_to? :specification_version then
         
     | 
| 
      
 44 
     | 
    
         
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         
     | 
| 
      
 45 
     | 
    
         
            +
                s.specification_version = 3
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         
     | 
| 
      
 48 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<addressable>, [">= 2.1.1"])
         
     | 
| 
      
 49 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<json>, [">= 1.2.3"])
         
     | 
| 
      
 50 
     | 
    
         
            +
                  s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
         
     | 
| 
      
 51 
     | 
    
         
            +
                  s.add_development_dependency(%q<artifice>, [">= 0.5"])
         
     | 
| 
      
 52 
     | 
    
         
            +
                else
         
     | 
| 
      
 53 
     | 
    
         
            +
                  s.add_dependency(%q<addressable>, [">= 2.1.1"])
         
     | 
| 
      
 54 
     | 
    
         
            +
                  s.add_dependency(%q<json>, [">= 1.2.3"])
         
     | 
| 
      
 55 
     | 
    
         
            +
                  s.add_dependency(%q<shoulda>, [">= 2.10.3"])
         
     | 
| 
      
 56 
     | 
    
         
            +
                  s.add_dependency(%q<artifice>, [">= 0.5"])
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              else
         
     | 
| 
      
 59 
     | 
    
         
            +
                s.add_dependency(%q<addressable>, [">= 2.1.1"])
         
     | 
| 
      
 60 
     | 
    
         
            +
                s.add_dependency(%q<json>, [">= 1.2.3"])
         
     | 
| 
      
 61 
     | 
    
         
            +
                s.add_dependency(%q<shoulda>, [">= 2.10.3"])
         
     | 
| 
      
 62 
     | 
    
         
            +
                s.add_dependency(%q<artifice>, [">= 0.5"])
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
            end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - ecin
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-04- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-04-28 00:00:00 -04:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -74,7 +74,7 @@ dependencies: 
     | 
|
| 
       74 
74 
     | 
    
         
             
              type: :development
         
     | 
| 
       75 
75 
     | 
    
         
             
              version_requirements: *id004
         
     | 
| 
       76 
76 
     | 
    
         
             
            description: Print Stuff Mail provides an RESTful API for sending snail mail. This library eases interfacing with it.
         
     | 
| 
       77 
     | 
    
         
            -
            email:  
     | 
| 
      
 77 
     | 
    
         
            +
            email: psm@copypastel.com
         
     | 
| 
       78 
78 
     | 
    
         
             
            executables: []
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
            extensions: []
         
     | 
| 
         @@ -84,9 +84,11 @@ extra_rdoc_files: 
     | 
|
| 
       84 
84 
     | 
    
         
             
            files: 
         
     | 
| 
       85 
85 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       86 
86 
     | 
    
         
             
            - README.textile
         
     | 
| 
      
 87 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
       87 
88 
     | 
    
         
             
            - VERSION
         
     | 
| 
       88 
89 
     | 
    
         
             
            - lib/psm.rb
         
     | 
| 
       89 
90 
     | 
    
         
             
            - lib/psm/session.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - psm.gemspec
         
     | 
| 
       90 
92 
     | 
    
         
             
            - test/fake_service.rb
         
     | 
| 
       91 
93 
     | 
    
         
             
            - test/psm/session_test.rb
         
     | 
| 
       92 
94 
     | 
    
         
             
            - test/psm_test.rb
         
     |