smartsend-ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0e21904f9f72b5f2539f62b745eae8ebd0e796ac
4
+ data.tar.gz: b8fc28840c4ace20f5e760f05f47008fc950cbfd
5
+ SHA512:
6
+ metadata.gz: 1dce17d09126216ec231abefee7a2e4ee8b7840e0e529d8cf12d8a18dab39d2b8fc4de84dbc6ddd88adeeee0cdf6b0c1a259506fdaa0320b6caac65a698af34d
7
+ data.tar.gz: 8bc153718756d6ddd37b6a15cf43362ae4511f16261f5dbd5aa194a37de1ec52af912ed413d4ac05f20ed7d732e342342ddab64ac3d8538838180af06f49cc7f
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ # ignore gem build
2
+ /*.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # README
2
+
3
+ This is a ruby wrapper for the Smartsend.io api.
4
+
5
+ Before beginning you need a Smartsend account.
6
+
7
+ ## Installation
8
+
9
+ ```ruby
10
+ gem install 'smartsend-ruby'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Configuring the client
16
+
17
+ ```ruby
18
+ Smartsend.configure(
19
+ api_key: 'smartsend-api-key',
20
+ email: 'smartsend-username',
21
+ license: 'smartsend-license-key',
22
+ cms_system: 'Ruby on Rails',
23
+ cms_version: '5.0.0'
24
+ )
25
+ ```
26
+
27
+ ### Creating an order
28
+
29
+ This creates a label.
30
+
31
+ ```ruby
32
+ order = Smartsend::Order.new(
33
+ order_number: "AC12345789",
34
+ carrier: "postdanmark", # postdanmark/gls/bring
35
+ method: "private",
36
+ return: false,
37
+ total_price: 199.75,
38
+ shipping_price: 49,
39
+ currency: "DKK"
40
+ )
41
+
42
+ order.receiver = Smartsend::Receiver.new(
43
+ id: "123456", # your internal customer id
44
+ company: "Smart Send",
45
+ name1: "Henrik Hansen",
46
+ name2: "C/O Vivian Hansen",
47
+ address1: "Willemoesgade 42",
48
+ address2: "3.th.",
49
+ zip: "2100",
50
+ city: "Copenhagen",
51
+ country: "DK",
52
+ phone: "12345678",
53
+ mail: "contact@smartsend.io",
54
+ sms_notification: "12345678",
55
+ email_notification: "contact@smartsend.io"
56
+ )
57
+
58
+ order.sender = Smartsend::Sender.new(
59
+ company: "Smart Send",
60
+ name1: "Henrik Hansen",
61
+ name2: "C/O Vivian Hansen",
62
+ address1: "Willemoesgade 42",
63
+ address2: "3.th.",
64
+ zip: "2100",
65
+ city: "Copenhagen",
66
+ country: "DK",
67
+ sms: "12345678",
68
+ mail: "contact@smartsend.io"
69
+ )
70
+
71
+ # you can ship to a droppoint by defining an agent
72
+ order.agent = Smartsend::Agent.new(
73
+ id: "7224", # droppoint id
74
+ type: "PDK", # droppoint provider
75
+ company: "Smart Send",
76
+ name1: "Henrik Hansen",
77
+ name2: "C/O Vivian Hansen",
78
+ address1: "Willemoesgade 42",
79
+ address2: "3.th.",
80
+ zip: "2100",
81
+ city: "Copenhagen",
82
+ country: "DK",
83
+ phone: "12345678",
84
+ mail: "contact@smartsend.io"
85
+ )
86
+
87
+ parcel = Smartsend::Parcel.new(
88
+ shipped_at: DateTime.now,
89
+ reference: "123456789", # your internal parcel id
90
+ weight: 1.25,
91
+ height: 21,
92
+ width: 27,
93
+ length: 35,
94
+ size: "large",
95
+ freetext_lines: [ # you can add up to 3 lines of freetext to be printed on the label
96
+ "Brians birthsday gift",
97
+ "Don't open this before your birthsday Brian",
98
+ "We look forward to seeing you soon Brian"
99
+ ]
100
+ )
101
+
102
+ parcel_item = Smartsend::ParcelItem.new(
103
+ sku: "ABC123",
104
+ title: "ABC123",
105
+ quantity: 2,
106
+ unitweight: 1.25,
107
+ unitprice: 144.5,
108
+ currency: "DKK"
109
+ )
110
+
111
+ parcel.items = [parcel_item]
112
+ order.parcels = [parcel]
113
+
114
+ # send the order to Smartsend.io
115
+ order.save!
116
+ ```
117
+
118
+ After saving an order it is updated with a url for the label pdf and tracking codes for each parcel.
119
+
120
+ ```ruby
121
+ order.label_url
122
+ => 'https://www.pacsoftonline.com/...'
123
+
124
+ order.parcels.first.tracking_code
125
+ => '1234...'
126
+
127
+ order.parcels.first.tracking_url
128
+ => 'https://...'
129
+ ```
130
+
131
+ ### Creating orders in batch
132
+
133
+ You can create up to 10 orders in batch.
134
+
135
+ ```ruby
136
+ order1 = Smartsend::Order.new(...)
137
+ order2 = Smartsend::Order.new(...)
138
+
139
+ orders = Smartsend::Orders.new(order1, order2)
140
+
141
+ # send the orders to Smartsend.io
142
+ orders.save_all!
143
+
144
+ orders.first.label_url
145
+ => 'https://www.pacsoftonline.com/...'
146
+ ```
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -0,0 +1,25 @@
1
+ class Smartsend::Address
2
+ attr_accessor :id, :company ,:name1 ,:name2 ,:address1 ,:address2 ,:zip ,:city ,:country ,:phone ,:mail
3
+
4
+ def initialize(args={})
5
+ args.each do |k, v|
6
+ instance_variable_set "@#{k}", v
7
+ end
8
+ end
9
+
10
+ def serialize
11
+ {
12
+ :company => @company,
13
+ :name1 => @name1,
14
+ :name2 => @name2,
15
+ :address1 => @address1,
16
+ :address2 => @address2,
17
+ :zip => @zip,
18
+ :city => @city,
19
+ :country => @country,
20
+ :sms => @phone,
21
+ :mail => @mail
22
+ }
23
+ end
24
+
25
+ end
@@ -0,0 +1,12 @@
1
+ class Smartsend::Agent < Smartsend::Address
2
+ attr_accessor :carrier
3
+
4
+ def serialize
5
+ super.merge(
6
+ id: @id,
7
+ agentno: @id,
8
+ agenttype: @carrier
9
+ )
10
+ end
11
+
12
+ end
@@ -0,0 +1,34 @@
1
+ require 'http'
2
+
3
+ class Smartsend::Client
4
+
5
+ BASE_URL = 'http://smartsend-prod.apigee.net/v7/booking'.freeze
6
+
7
+ def post(path, params)
8
+ response = http.post("#{BASE_URL}/#{path}", json: params)
9
+ response = JSON.parse(response)
10
+
11
+ Rails.logger.debug(response) if defined?(Rails)
12
+
13
+ response
14
+ end
15
+
16
+ private
17
+
18
+ def http
19
+ raise Smartsend::MissingConfigError, 'Missing api_key' if Smartsend.api_key.nil?
20
+ raise Smartsend::MissingConfigError, 'Missing email' if Smartsend.email.nil?
21
+ raise Smartsend::MissingConfigError, 'Missing license' if Smartsend.license.nil?
22
+
23
+ HTTP.headers(
24
+ apikey: Smartsend.api_key,
25
+ smartsendmail: Smartsend.email,
26
+ smartsendlicence: Smartsend.license,
27
+ cmssystem: Smartsend.cms_system,
28
+ cmsversion: Smartsend.cms_version,
29
+ appversion: Smartsend.app_version,
30
+ test: Smartsend.test?
31
+ )
32
+ end
33
+
34
+ end
@@ -0,0 +1,57 @@
1
+ class Smartsend::Order
2
+ attr_accessor :id, :label_url, :order_number, :carrier, :method, :return, :total_price, :shipping_price, :currency,
3
+ :sender, :receiver, :agent, :parcels, :sms_notification, :email_notification
4
+
5
+ def initialize(args={})
6
+ args.each do |k, v|
7
+ instance_variable_set "@#{k}", v
8
+ end
9
+ end
10
+
11
+ def save!
12
+ response = Smartsend::Client.new.post('order', self.serialize)
13
+
14
+ update_label_url_tracking_codes(response)
15
+
16
+ self
17
+ end
18
+
19
+ def update_label_url_tracking_codes(response)
20
+ @id = response['id']
21
+ @label_url = response['link']
22
+
23
+ response['parcels'].each do |parcel_response|
24
+ if parcel = @parcels.select { |x| x.reference.to_s == parcel_response['reference'].to_s }.first
25
+ parcel.tracking_code = parcel_response['tracecode']
26
+ parcel.tracking_url = parcel_response['tracelink']
27
+ end
28
+ end
29
+ end
30
+
31
+
32
+ def serialize
33
+ {
34
+ orderno: @order_number,
35
+ carrier: @carrier,
36
+ method: @method,
37
+ return: @return,
38
+ totalprice: @total_price,
39
+ shipprice: @shipping_price,
40
+ currency: @currency,
41
+ test: false,
42
+ type: 'pdf',
43
+ sender: @sender&.serialize,
44
+ receiver: @receiver&.serialize,
45
+ agent: @agent&.serialize,
46
+ parcels: @parcels.to_a.map(&:serialize),
47
+ service: service.serialize
48
+ }
49
+ end
50
+
51
+ private
52
+
53
+ def service
54
+ Smartsend::Service.new(phone: @sms_notification, email: @email_notification)
55
+ end
56
+
57
+ end
@@ -0,0 +1,36 @@
1
+ class Smartsend::Orders
2
+ include Enumerable
3
+
4
+ def initialize(*orders)
5
+ @orders = orders
6
+ end
7
+
8
+ def save_all!
9
+ raise Smartsend::TooManyOrdersError, "You can save a maximum of 10 orders in batch" if count > 10
10
+
11
+ response = Smartsend::Client.new.post('orders', self.serialize)
12
+
13
+ update_label_url_tracking_codes(response)
14
+
15
+ self
16
+ end
17
+
18
+ def update_label_url_tracking_codes(response)
19
+ response['orders'].each do |response_order|
20
+ if order = @orders.select { |x| x.order_number.to_s == response.orderno.to_s }.first
21
+ order.update_label_url_tracking_codes(response)
22
+ end
23
+ end
24
+ end
25
+
26
+ def serialize
27
+ @orders.map(&:serialize)
28
+ end
29
+
30
+ def each(&block)
31
+ @orders.each do |order|
32
+ block.call(order)
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,30 @@
1
+ class Smartsend::Parcel
2
+ attr_accessor :id, :tracking_code, :tracking_url, :shipped_at, :reference, :weight, :height, :width, :length, :size, :freetext_lines, :items
3
+
4
+ def initialize(args={})
5
+ args.each do |k, v|
6
+ instance_variable_set "@#{k}", v
7
+ end
8
+ end
9
+
10
+ def serialize
11
+ params = {
12
+ :shipdate => @shipped_at,
13
+ :reference => @reference,
14
+ :weight => @weight,
15
+ :height => @height,
16
+ :width => @width,
17
+ :length => @length,
18
+ :size => @size,
19
+ :items => @items.to_a.map(&:serialize)
20
+ }
21
+
22
+ freetext_lines.to_a.each_with_index do |line, i|
23
+ params["freetext#{i.next}".to_sym] = line
24
+ end
25
+
26
+ params
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,21 @@
1
+ class Smartsend::ParcelItem
2
+ attr_accessor :sku, :title, :quantity, :unit_weight, :unit_price, :currency
3
+
4
+ def initialize(args={})
5
+ args.each do |k, v|
6
+ instance_variable_set "@#{k}", v
7
+ end
8
+ end
9
+
10
+ def serialize
11
+ {
12
+ :sku => @sku,
13
+ :title => @title,
14
+ :quantity => @quantity,
15
+ :unitweight => @unit_weight,
16
+ :unitprice => @unit_price,
17
+ :currency => @currency
18
+ }
19
+ end
20
+
21
+ end
@@ -0,0 +1,5 @@
1
+ class Smartsend::Receiver < Smartsend::Address
2
+ def serialize
3
+ super.merge(reciverid: @id)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class Smartsend::Sender < Smartsend::Address
2
+ def serialize
3
+ super.merge(senderid: nil)
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ class Smartsend::Service
2
+ attr_accessor :email, :phone
3
+
4
+ def initialize(args={})
5
+ args.each do |k, v|
6
+ instance_variable_set "@#{k}", v
7
+ end
8
+ end
9
+
10
+ def serialize
11
+ {
12
+ "notemail": @email,
13
+ "notesms": @phone,
14
+ "prenote": true,
15
+ "prenote_from": "contact@smartsend.io",
16
+ "prenote_to": "contact@smartsend.io",
17
+ "prenote_message": "Your order is now on the way.",
18
+ "flex": "string",
19
+ "waybillid": "string"
20
+ }
21
+ end
22
+
23
+ end
@@ -0,0 +1,3 @@
1
+ module Smartsend
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'smartsend'
data/lib/smartsend.rb ADDED
@@ -0,0 +1,67 @@
1
+ module Smartsend
2
+
3
+ @@api_key = nil
4
+ @@email = nil
5
+ @@license = nil
6
+ @@cms_system = nil
7
+ @@cms_version = nil
8
+ @@test_mode = false
9
+
10
+ def self.configure(args={})
11
+ args.each do |k, v|
12
+ class_variable_set "@@#{k}", v
13
+ end
14
+ end
15
+
16
+ def self.api_key
17
+ @@api_key
18
+ end
19
+
20
+ def self.email
21
+ @@email
22
+ end
23
+
24
+ def self.license
25
+ @@license
26
+ end
27
+
28
+ def self.cms_system
29
+ @@cms_system
30
+ end
31
+
32
+ def self.cms_version
33
+ @@cms_version
34
+ end
35
+
36
+ def self.app_version
37
+ Smartsend::VERSION
38
+ end
39
+
40
+ def self.test_mode
41
+ @@test_mode
42
+ end
43
+
44
+ def self.test?
45
+ test_mode
46
+ end
47
+
48
+
49
+ class TooManyOrdersError < StandardError
50
+ end
51
+
52
+ class MissingConfigError < StandardError
53
+ end
54
+
55
+
56
+ end
57
+
58
+ require 'smartsend/order'
59
+ require 'smartsend/orders'
60
+ require 'smartsend/address'
61
+ require 'smartsend/receiver'
62
+ require 'smartsend/sender'
63
+ require 'smartsend/agent'
64
+ require 'smartsend/service'
65
+ require 'smartsend/parcel'
66
+ require 'smartsend/parcel_item'
67
+ require 'smartsend/client'
@@ -0,0 +1,22 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "smartsend/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'smartsend-ruby'
7
+ s.version = Smartsend::VERSION
8
+ s.date = '2017-11-13'
9
+ s.summary = "Smartsend.io api client"
10
+ s.description = "Create orders in smartsend for smartsend"
11
+ s.authors = ["Aske Hansen"]
12
+ s.email = 'aske@deeco.dk'
13
+ s.homepage = 'https://github.com/askehansen/smartsend-ruby'
14
+ s.license = 'MIT'
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'http', '~> 2.2'
22
+ end
@@ -0,0 +1,80 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class AddressesTest < Minitest::Test
5
+
6
+ def test_sender_serializing
7
+ sender = Smartsend::Sender.new(address)
8
+
9
+ assert_equal({
10
+ "senderid": nil,
11
+ "company": "Smart Send",
12
+ "name1": "Henrik Hansen",
13
+ "name2": "C/O Vivian Hansen",
14
+ "address1": "Willemoesgade 42",
15
+ "address2": "3.th.",
16
+ "zip": 2100,
17
+ "city": "Copenhagen",
18
+ "country": "DK",
19
+ "sms": 12345678,
20
+ "mail": "contact@smartsend.io"
21
+ }, sender.serialize)
22
+ end
23
+
24
+ def test_reciver_serializing
25
+ receiver = Smartsend::Receiver.new(address)
26
+
27
+ assert_equal({
28
+ "reciverid": 1,
29
+ "company": "Smart Send",
30
+ "name1": "Henrik Hansen",
31
+ "name2": "C/O Vivian Hansen",
32
+ "address1": "Willemoesgade 42",
33
+ "address2": "3.th.",
34
+ "zip": 2100,
35
+ "city": "Copenhagen",
36
+ "country": "DK",
37
+ "sms": 12345678,
38
+ "mail": "contact@smartsend.io"
39
+ }, receiver.serialize)
40
+ end
41
+
42
+ def test_agent_serializing
43
+ receiver = Smartsend::Agent.new(address.merge(carrier: 'PDK'))
44
+
45
+ assert_equal({
46
+ "id": 1,
47
+ "agentno": 1,
48
+ "agenttype": "PDK",
49
+ "company": "Smart Send",
50
+ "name1": "Henrik Hansen",
51
+ "name2": "C/O Vivian Hansen",
52
+ "address1": "Willemoesgade 42",
53
+ "address2": "3.th.",
54
+ "zip": 2100,
55
+ "city": "Copenhagen",
56
+ "country": "DK",
57
+ "sms": 12345678,
58
+ "mail": "contact@smartsend.io"
59
+ }, receiver.serialize)
60
+ end
61
+
62
+ private
63
+
64
+ def address
65
+ {
66
+ :id => 1,
67
+ :company => "Smart Send",
68
+ :name1 => "Henrik Hansen",
69
+ :name2 => "C/O Vivian Hansen",
70
+ :address1 => "Willemoesgade 42",
71
+ :address2 => "3.th.",
72
+ :zip => 2100,
73
+ :city => "Copenhagen",
74
+ :country => "DK",
75
+ :phone => 12345678,
76
+ :mail => "contact@smartsend.io"
77
+ }
78
+ end
79
+
80
+ end
@@ -0,0 +1,9 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class ClientTest < Minitest::Test
5
+
6
+ def test_headers
7
+ end
8
+
9
+ end
@@ -0,0 +1,62 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class OrdersTest < Minitest::Test
5
+
6
+ def test_serializing
7
+ assert_equal(params, order.serialize)
8
+ end
9
+
10
+ def test_collection_serializing
11
+ orders = Smartsend::Orders.new(order, order)
12
+
13
+ assert_equal 2, orders.count
14
+ assert_equal [params, params], orders.serialize
15
+ end
16
+
17
+ def test_too_many_orders_errors
18
+ assert_raises Smartsend::TooManyOrdersError do
19
+ Smartsend::Orders.new(*(0..10).to_a).save_all!
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def params
26
+ {
27
+ orderno: 'AC12345789',
28
+ carrier: 'postdanmark',
29
+ method: 'private',
30
+ return: false,
31
+ totalprice: 199.75,
32
+ shipprice: 49,
33
+ currency: 'DKK',
34
+ test: false,
35
+ type: 'pdf',
36
+ sender: nil,
37
+ receiver: nil,
38
+ agent: nil,
39
+ parcels: [],
40
+ service: {:notemail=>"contact@smartsend.io", :notesms=>"12345678", :prenote=>true, :prenote_from=>"contact@smartsend.io", :prenote_to=>"contact@smartsend.io", :prenote_message=>"Your order is now on the way.", :flex=>"string", :waybillid=>"string"}
41
+ }
42
+ end
43
+
44
+ def order
45
+ Smartsend::Order.new(
46
+ :order_number => "AC12345789",
47
+ :carrier => "postdanmark",
48
+ :method => "private",
49
+ :return => false,
50
+ :total_price => 199.75,
51
+ :shipping_price => 49,
52
+ :currency => "DKK",
53
+ :sms_notification => '12345678',
54
+ :email_notification => 'contact@smartsend.io',
55
+ sender: nil,
56
+ receiver: nil,
57
+ agent: nil,
58
+ parcels: []
59
+ )
60
+ end
61
+
62
+ end
@@ -0,0 +1,26 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class ParcelItemsTest < Minitest::Test
5
+
6
+ def test_serializing
7
+ parcel_item = Smartsend::ParcelItem.new(
8
+ sku: 'ABC123',
9
+ title: 'ABC123',
10
+ quantity: 2,
11
+ unit_weight: 1.25,
12
+ unit_price: 144.5,
13
+ currency: 'DKK'
14
+ )
15
+
16
+ assert_equal({
17
+ "sku": "ABC123",
18
+ "title": "ABC123",
19
+ "quantity": 2,
20
+ "unitweight": 1.25,
21
+ "unitprice": 144.5,
22
+ "currency": "DKK"
23
+ }, parcel_item.serialize)
24
+ end
25
+
26
+ end
@@ -0,0 +1,42 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class ParcelsTest < Minitest::Test
5
+
6
+ def test_serializing
7
+ parcel = Smartsend::Parcel.new(
8
+ :shipped_at => Time.new(2017, 11, 30, 16, 46, 04, 0),
9
+ :reference => '123456789',
10
+ :weight => 1.25,
11
+ :height => 21,
12
+ :width => 27,
13
+ :length => 35,
14
+ :size => "large",
15
+ :items => [],
16
+ :freetext_lines => [
17
+ "Brians birthsday gift",
18
+ "Don't open this before your birthsday Brian",
19
+ "We look forward to seeing you soon Brian"
20
+ ]
21
+ )
22
+
23
+ assert_equal({
24
+ "shipdate": Time.new(2017, 11, 30, 16, 46, 04, 0),
25
+ "reference": "123456789",
26
+ "weight": 1.25,
27
+ "height": 21,
28
+ "width": 27,
29
+ "length": 35,
30
+ "size": "large",
31
+ "freetext1": "Brians birthsday gift",
32
+ "freetext2": "Don't open this before your birthsday Brian",
33
+ "freetext3": "We look forward to seeing you soon Brian",
34
+ "items": []
35
+ }, parcel.serialize)
36
+ end
37
+
38
+ private
39
+
40
+
41
+
42
+ end
@@ -0,0 +1,21 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class SerivceTest < Minitest::Test
5
+
6
+ def test_serializing
7
+ service = Smartsend::Service.new(email: 'contact@smartsend.io', phone: '12345678')
8
+
9
+ assert_equal({
10
+ "notemail": "contact@smartsend.io",
11
+ "notesms": "12345678",
12
+ "prenote": true,
13
+ "prenote_from": "contact@smartsend.io",
14
+ "prenote_to": "contact@smartsend.io",
15
+ "prenote_message": "Your order is now on the way.",
16
+ "flex": "string",
17
+ "waybillid": "string"
18
+ }, service.serialize)
19
+ end
20
+
21
+ end
@@ -0,0 +1,18 @@
1
+ require 'minitest/autorun'
2
+ require 'smartsend'
3
+
4
+ class SmartsendTest < Minitest::Test
5
+
6
+ def test_configuration
7
+ Smartsend.configure(
8
+ api_key: 'test_key',
9
+ email: 'test@test.com',
10
+ license: 'test_license'
11
+ )
12
+
13
+ assert_equal Smartsend.api_key, 'test_key'
14
+ assert_equal Smartsend.email, 'test@test.com'
15
+ assert_equal Smartsend.license, 'test_license'
16
+ end
17
+
18
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smartsend-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Aske Hansen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
27
+ description: Create orders in smartsend for smartsend
28
+ email: aske@deeco.dk
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".gitignore"
34
+ - Gemfile
35
+ - README.md
36
+ - Rakefile
37
+ - lib/smartsend-ruby.rb
38
+ - lib/smartsend.rb
39
+ - lib/smartsend/address.rb
40
+ - lib/smartsend/agent.rb
41
+ - lib/smartsend/client.rb
42
+ - lib/smartsend/order.rb
43
+ - lib/smartsend/orders.rb
44
+ - lib/smartsend/parcel.rb
45
+ - lib/smartsend/parcel_item.rb
46
+ - lib/smartsend/receiver.rb
47
+ - lib/smartsend/sender.rb
48
+ - lib/smartsend/service.rb
49
+ - lib/smartsend/version.rb
50
+ - smartsend-ruby.gemspec
51
+ - test/test_addresses.rb
52
+ - test/test_client.rb
53
+ - test/test_orders.rb
54
+ - test/test_parcel_items.rb
55
+ - test/test_parcels.rb
56
+ - test/test_service.rb
57
+ - test/test_smartsend.rb
58
+ homepage: https://github.com/askehansen/smartsend-ruby
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.5.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Smartsend.io api client
82
+ test_files:
83
+ - test/test_addresses.rb
84
+ - test/test_client.rb
85
+ - test/test_orders.rb
86
+ - test/test_parcel_items.rb
87
+ - test/test_parcels.rb
88
+ - test/test_service.rb
89
+ - test/test_smartsend.rb