seeuletter 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1408fe288ce4a9b2f41d176873e32c47a2717dcf
4
- data.tar.gz: a958dad52b535b938c0d60183969cf99cf6bf148
3
+ metadata.gz: c95ab7d39cc66975f788f128075a0678c5af426a
4
+ data.tar.gz: 3c6582b0e1abd7f6e2366c78f1033f9c3707f055
5
5
  SHA512:
6
- metadata.gz: 678d19d0e7976d2b154d15f5ff6487d57d8b2da53ec308e91ad8ac9ea904a91e388bb695936d4ce01621f130a0c37937f8ca185616e073427e07457a445b369c
7
- data.tar.gz: a5dcf091b2165b1cac85fa2a0742c81e69ffde43bce15862826c4df69ad77a22e3f4ebf7e4437f6dfc5195368bf4af6d18187b0265eb58a6d22b7d54e59c827f
6
+ metadata.gz: 52f655b93b2b77029b9a461408388af761651f2a7af372fe2eaa13d23585b117479d3f6c6b276a8c1b6a03803edb7e1bd920f990884db061a00c17abd9142808
7
+ data.tar.gz: '02864672a80c3e8c18e069766fdebe1214b97259f08a1532c106d7a06841043f586e5a0e8974d09ca8f24bece59c22418f8b7250bd05157fa7c78763c9f883b1'
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # seeuletter-ruby
2
2
 
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/seeuletter.svg)](https://badge.fury.io/rb/seeuletter)
5
+
6
+
3
7
  Ruby wrapper for the [Seeuletter.com](https://www.seeuletter.com) API. See the full Seeuletter.com [API Documentation](https://docs.seeuletter.com/?ruby#). For best results, be sure that you're using the latest version of the Seeuletter API and the latest version of the ruby wrapper. This gem gives you an ActiveRecord-style syntax to use the Seeuletter.com API.
4
8
 
5
9
  Supports Ruby 2.0.0 and greater.
@@ -16,13 +20,13 @@ Supports Ruby 2.0.0 and greater.
16
20
 
17
21
  Here's a general overview of the Seeuletter services available, click through to read more.
18
22
 
19
- Please read through the official [API Documentation](#api-documentation) to get a complete sense of what to expect from each endpoint.
23
+ Please read through the official [API Documentation](https://docs.seeuletter.com/?ruby#) to get a complete sense of what to expect from each endpoint.
20
24
 
21
25
  ### Registration
22
26
 
23
27
  First, you will need to first create an account at [Seeuletter.com](https://www.seeuletter.com/signup) and obtain your Test and Live API Keys.
24
28
 
25
- Once you have created an account, you can access your API Keys from the [Settings Panel](https://www.seeuletter.com/app/dashboard/keys).
29
+ Once you have created an account, you can access your API Keys from the [API Keys Panel](https://www.seeuletter.com/app/dashboard/keys).
26
30
 
27
31
  ### Installation
28
32
 
@@ -40,7 +44,7 @@ Or manually install it yourself:
40
44
 
41
45
  ### Usage
42
46
 
43
- The library uses an ActiveRecord-style interface. You'll feel right at home.
47
+ The library uses an ActiveRecord-style interface.
44
48
 
45
49
  For optional parameters and other details, refer to the docs [here](https://docs.seeuletter.com/?ruby#).
46
50
 
@@ -51,6 +55,62 @@ For optional parameters and other details, refer to the docs [here](https://docs
51
55
  seeuletter = Seeuletter::Client.new(api_key: "your-api-key")
52
56
  ```
53
57
 
58
+ #### Create a new letter
59
+
60
+ ```ruby
61
+ # send the letter
62
+ require 'seeuletter'
63
+
64
+ # initialize Seeuletter object
65
+ seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
66
+
67
+ puts seeuletter.letters.create(
68
+ description: "Test letter from the Ruby Wrapper",
69
+ to: {
70
+ name: 'Erlich',
71
+ address_line1: '30 rue de rivoli',
72
+ address_line2: '',
73
+ address_city: 'Paris',
74
+ address_country: 'France',
75
+ address_postalcode: '75004'
76
+ },
77
+ source_file: '<html>Hello {{name}}</html>',
78
+ source_file_type: 'html',
79
+ postage_type: 'prioritaire',
80
+ variables: { name: 'Erlich'},
81
+ color: 'color'
82
+ )
83
+ ```
84
+
85
+ #### List all letters
86
+
87
+ ```ruby
88
+ require 'seeuletter'
89
+
90
+ seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
91
+
92
+ puts seeuletter.letters.list()
93
+ ```
94
+
95
+ #### Get a specific letter
96
+
97
+ ```ruby
98
+ require 'seeuletter'
99
+
100
+ seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
101
+
102
+ puts seeuletter.letters.find('LETTER_ID')
103
+ ```
104
+ #### Get the price of a letter
105
+
106
+ ```ruby
107
+ require 'seeuletter'
108
+
109
+ seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
110
+
111
+ puts seeuletter.letter_price.get(color: 'bw', postage_type: 'prioritaire', postage_speed: 'D1', page_count: 1)
112
+ ```
113
+
54
114
  #### Caution: Pass zero-prefixed postal codes as strings
55
115
 
56
116
  When using postal codes with zero-prefixes, always quote them. For example when specifying `02125`, pass it as a string `"02125"`, instead of an integer.
@@ -65,7 +125,7 @@ You can access response headers via a hidden `headers` method on the response ha
65
125
  addresses = seeuletter.addresses.list
66
126
 
67
127
  addresses._response.headers[:content_type]
68
- # => "application/json; charset=utf-8"
128
+ # => "application/json"
69
129
  ```
70
130
 
71
131
 
@@ -0,0 +1,6 @@
1
+ $:.unshift File.expand_path("../lib", File.dirname(__FILE__))
2
+ require 'seeuletter'
3
+
4
+ seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
5
+
6
+ puts seeuletter.letter_price.get(color: 'bw', postage_type: 'prioritaire', postage_speed: 'D1', page_count: 1)
@@ -1,4 +1,5 @@
1
1
  require "seeuletter/resources/letter"
2
+ require 'seeuletter/resources/letter_price'
2
3
 
3
4
  module Seeuletter
4
5
  class Client
@@ -17,5 +18,8 @@ module Seeuletter
17
18
  Seeuletter::Resources::Letter.new(config)
18
19
  end
19
20
 
21
+ def letter_price
22
+ Seeuletter::Resources::LetterPrice.new(config)
23
+ end
20
24
  end
21
25
  end
@@ -0,0 +1,14 @@
1
+ require "seeuletter/resources/resource_base"
2
+
3
+ module Seeuletter
4
+ module Resources
5
+ class LetterPrice < Seeuletter::Resources::ResourceBase
6
+ def initialize(config)
7
+ super(config)
8
+ @endpoint = "price/letter"
9
+ end
10
+
11
+ alias get list
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Seeuletter
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seeuletter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seeuletter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-26 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -71,12 +71,14 @@ files:
71
71
  - README.md
72
72
  - Rakefile
73
73
  - examples/README.md
74
+ - examples/letter_price.rb
74
75
  - examples/letters.rb
75
76
  - lib/seeuletter.rb
76
77
  - lib/seeuletter/client.rb
77
78
  - lib/seeuletter/errors/invalid_request_error.rb
78
79
  - lib/seeuletter/errors/seeuletter_error.rb
79
80
  - lib/seeuletter/resources/letter.rb
81
+ - lib/seeuletter/resources/letter_price.rb
80
82
  - lib/seeuletter/resources/resource_base.rb
81
83
  - lib/seeuletter/version.rb
82
84
  - seeuletter.gemspec