intelipost 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,6 +10,7 @@ Gem for the Intelipost API
10
10
  ### Usage:
11
11
 
12
12
  ````ruby
13
+ # GET /cep_address/complete
13
14
  require 'intelipost'
14
15
 
15
16
  client = Intelipost::Client.new api_key: <your api key>
@@ -19,6 +20,25 @@ address.content.street
19
20
  # => "R Maj Paladino"
20
21
  ````
21
22
 
23
+ ````ruby
24
+ # POST /quote
25
+ require 'intelipost'
26
+
27
+ client = Intelipost::Client.new api_key: <your api key>
28
+ quote = client.quote.create({hash_of :intelipost, required: :args})
29
+ # => #<Hashie::Mash content=#<Hashie::Mash additional_information=#<Hashie::Mash client_type="gold" delivery_method_ids=[4, 3, 2] extra_cost_absolute=0.0 extra_cost_percentage=0.0 free_shipping=false lead_time_business_days=0 sales_channel="hotsite" tax_id=nil> client_id=1783 created=1433872646799 created_iso="2015-06-09T14:57:26.799-03:00" delivery_options=[#<Hashie::Mash delivery_estimate_business_days=1 delivery_method_id=4 delivery_method_name="Total Express" delivery_method_type="EXPRESS" delivery_note=nil description="Total Express" final_shipping_cost=5.05 logistic_provider_name="Total" provider_shipping_cost=5.05>, #<Hashie::Mash delivery_estimate_business_days=1 delivery_method_id=3 delivery_method_name="Correios eSedex" delivery_method_type="EXPRESS" delivery_note=nil description="Correios eSedex" final_shipping_cost=7.83 logistic_provider_name="Correios" provider_shipping_cost=7.83>, #<Hashie::Mash delivery_estimate_business_days=1 delivery_method_id=2 delivery_method_name="Correios Sedex" delivery_method_type="EXPRESS" delivery_note=nil description="Correios Sedex" final_shipping_cost=13.83 logistic_provider_name="Correios" provider_shipping_cost=13.83>] destination_zip_code="06396-200" id=4347667 origin_zip_code="04037-003" platform=nil volumes=[#<Hashie::Mash cost_of_goods=100.0 description=nil height=10.0 length=10.0 volume_type="BOX" weight=0.1 width=10.0>]> messages=[] status="OK" time="34.0 ms">
30
+ quote.content.id
31
+ # => 4347667
32
+ ````
33
+
34
+ ````ruby
35
+ # POST /shipment_order
36
+ require 'intelipost'
37
+
38
+ client = Intelipost::Client.new api_key: <your api key>
39
+ client.shipment_order.create({hash_of: :intelipost, args: :values})
40
+ ````
41
+
22
42
  ### Development:
23
43
 
24
44
  For testing, create a `.env` file with the following content:
data/lib/intelipost.rb CHANGED
@@ -8,6 +8,7 @@ require 'intelipost/fluent_interface'
8
8
  require 'intelipost/client'
9
9
  require 'intelipost/cep'
10
10
  require 'intelipost/quote'
11
+ require 'intelipost/shipment_order'
11
12
 
12
13
  module Intelipost
13
14
  end
@@ -0,0 +1,5 @@
1
+ module Intelipost
2
+ class ShipmentOrder < Intelipost::FluentInterfaceBase
3
+ set_endpoint 'shipment_order'
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Intelipost
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -0,0 +1,61 @@
1
+ # coding: utf-8
2
+
3
+ describe Intelipost::ShipmentOrder do
4
+ subject { Intelipost::ShipmentOrder.new(double('Intelipost::Client')) }
5
+
6
+ let(:order_to_ship) do
7
+ {
8
+ 'quote_id' => 59094,
9
+ 'delivery_method_id' => 2,
10
+ 'end_customer' => {
11
+ 'first_name' => 'Teste',
12
+ 'last_name' => 'QATLT',
13
+ 'email' => 'talita.sousa@intelipost.com.br',
14
+ 'phone' => '00231424551',
15
+ 'cellphone' => '01231233123',
16
+ 'is_company' => false,
17
+ 'federal_tax_payer_id' => '44611341801',
18
+ 'state_tax_payer_id' => '2314234',
19
+ 'shipping_address' => 'Avenida Paulista',
20
+ 'shipping_number' => '2',
21
+ 'shipping_additional' => 'Apto 202',
22
+ 'shipping_reference' => 'Supermercado Superpão',
23
+ 'shipping_quarter' => 'Consolação',
24
+ 'shipping_city' => 'São Paulo',
25
+ 'shipping_state' => 'São Paulo',
26
+ 'shipping_zip_code' => '01311-000',
27
+ 'shipping_country' => 'BR'
28
+ },
29
+ 'shipment_order_volume_array' => [
30
+ {
31
+ 'shipment_order_volume_number' => '1',
32
+ 'weight' => 3.2,
33
+ 'volume_type_code' => 'box',
34
+ 'width' => 10,
35
+ 'height' => 20,
36
+ 'length' => 30,
37
+ 'products_nature' => 'beverages',
38
+ 'products_quantity' => 3,
39
+ 'is_icms_exempt' => false,
40
+ 'tracking_code' => 'SW123456789BR',
41
+ 'shipment_order_volume_invoice' => {
42
+ 'invoice_series' => '1',
43
+ 'invoice_number' => '1000',
44
+ 'invoice_key' => '41140502834982004563550010000084111000132317',
45
+ 'invoice_date' => '12-03-14',
46
+ 'invoice_total_value' => '45.99',
47
+ 'invoice_products_value' => '39.99',
48
+ 'invoice_cfop' => '2890'
49
+ }
50
+ }
51
+ ],
52
+ 'order_number' => '09123241214TLT',
53
+ 'estimated_delivery_date' => '2014-12-15'
54
+ }
55
+ end
56
+
57
+ it 'correctly submit a shipment order' do
58
+ expect(subject.connection).to receive(:post).with('shipment_order', order_to_ship)
59
+ subject.create(order_to_ship)
60
+ end
61
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intelipost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-26 00:00:00.000000000 Z
12
+ date: 2015-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -207,11 +207,13 @@ files:
207
207
  - lib/intelipost/client.rb
208
208
  - lib/intelipost/fluent_interface.rb
209
209
  - lib/intelipost/quote.rb
210
+ - lib/intelipost/shipment_order.rb
210
211
  - lib/intelipost/version.rb
211
212
  - lib/middleware/gzip.rb
212
213
  - spec/lib/intelipost/cep_spec.rb
213
214
  - spec/lib/intelipost/client_spec.rb
214
215
  - spec/lib/intelipost/quote_spec.rb
216
+ - spec/lib/intelipost/shipment_order_spec.rb
215
217
  - spec/spec_helper.rb
216
218
  homepage: http://github.com/natuelabs/intelipost
217
219
  licenses:
@@ -242,4 +244,5 @@ test_files:
242
244
  - spec/lib/intelipost/cep_spec.rb
243
245
  - spec/lib/intelipost/client_spec.rb
244
246
  - spec/lib/intelipost/quote_spec.rb
247
+ - spec/lib/intelipost/shipment_order_spec.rb
245
248
  - spec/spec_helper.rb