myparcel 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NThiNjEwZmFhMWNkY2NiMDY1YjdiN2ZkM2VmMzg4MTYwNTcyYjM0OA==
5
- data.tar.gz: !binary |-
6
- NDNjMWM3OTZkYWEyMmUyN2NkYjBlNDk5YmU4NzdkM2Q4ZDcyYjdkOQ==
2
+ SHA1:
3
+ metadata.gz: 325accba19be5c2cb3e889a03c3fc9e478e04d99
4
+ data.tar.gz: 7dfe9f58daa0f64352a9c78cd6c8b49d10423098
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZDJiY2JiNjE3NmQ0Y2U2Y2M1NDYyMjhhMTlkYjI3NzlhMjM3ZDNjZTlkMDBj
10
- MDYyZDFmOWRlOGJmNDI0MGVkMGIzYjAxZjZiODg2NDFhZjVkOTdmZmViNWI1
11
- NDJmMDE1YTgxMDcxMzliNWM2NmI0ZjVlNjNiNDQ2NmIzMDM5ZTI=
12
- data.tar.gz: !binary |-
13
- M2I5NTFhNDMyYjhiMmNkM2UwNDkyZjJmZjAwNjVjN2IxZTg4ZmM5MzUzZmNj
14
- NmQxNTBiNDEyMTNkNjZiMmJmNDU5YjZjNTM4MDNmNmVkYTYzODc3MTAwNWY1
15
- NDM0MWI5NDAwYzI5ZmEyMGNjOGJhMDNhMDVkM2EyYThjMzg5NDQ=
6
+ metadata.gz: 324d3bf3b6428d5a416fd8a80782fcdc2b5ac36fd96d22db9c9b78e3467f464e88e79a021016c7ece41c8efddea20fce5fb9b0f35b7ad42770a2423f243d3113
7
+ data.tar.gz: 6345165600682354c2abf43a06bf5550cf69d32fbb4d0f1be6c4a48e5609041a2598aad086954e06bad437bc76e22a92bceb37e8a3919308ed33590242974272
data/README.md CHANGED
@@ -1,17 +1,15 @@
1
1
  [![Build Status](https://travis-ci.org/ivdma/myparcel.svg?branch=master)](https://travis-ci.org/ivdma/myparcel)
2
2
 
3
- # Myparcel
3
+ # MyParcel Ruby gem
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/myparcel`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- TODO: Delete this and the text above, and describe your gem
5
+ MyParcel Ruby gem provides a wrapper for [MyParcel API](https://myparcelnl.github.io/api/)
8
6
 
9
7
  ## Installation
10
8
 
11
9
  Add this line to your application's Gemfile:
12
10
 
13
11
  ```ruby
14
- gem 'myparcel'
12
+ gem 'myparcel', '~> 0.1'
15
13
  ```
16
14
 
17
15
  And then execute:
@@ -24,7 +22,88 @@ Or install it yourself as:
24
22
 
25
23
  ## Usage
26
24
 
27
- TODO: Write usage instructions here
25
+ ### Client
26
+
27
+ ```ruby
28
+ client = Myparcel.client('your-api-key')
29
+ ```
30
+
31
+ ### Shipments
32
+
33
+ Getting shipments by id:
34
+
35
+ ```ruby
36
+ client.shipments.find shipment_ids: [1, 2, 3]
37
+ ```
38
+
39
+ Getting all shipments:
40
+
41
+ ```ruby
42
+ client.shipments.all
43
+ # or
44
+ client.shipments.find
45
+ ```
46
+
47
+ Creating shipments:
48
+
49
+ ```ruby
50
+ shipment = {
51
+ recipient: {
52
+ cc: 'NL',
53
+ postal_code: '9999XX',
54
+ city: 'Amsterdam',
55
+ street: 'Hoofdstraat',
56
+ number: '1',
57
+ person: 'John Doe'
58
+ },
59
+ carrier: 1,
60
+ options: {
61
+ package_type: 1
62
+ },
63
+ status: 1
64
+ }
65
+ client.shipments.create shipments: [shipment]
66
+ ```
67
+
68
+ Deleting shipments (at least one ID is required):
69
+
70
+ ```ruby
71
+ client.shipments.delete shipment_ids: [1, 2, 3]
72
+ ```
73
+
74
+ ### Delivery options
75
+
76
+ Get possible delivery options for an address:
77
+
78
+ ```ruby
79
+ client.delivery_options.find cc: 'NL', postal_code: '2131bc', number: 679, carrier: 'postnl'
80
+ ```
81
+
82
+ ### Track and Trace
83
+
84
+ Getting Track&Trace codes by shipment IDs:
85
+
86
+ ```ruby
87
+ client.tracktraces.find shipment_ids: [1, 2, 3]
88
+ ```
89
+
90
+ ### Webhook subscriptions
91
+
92
+ Creating a webhook:
93
+
94
+ ```ruby
95
+ webhook = {
96
+ hook: "shipment_status_change",
97
+ url: "https://seoshop.nl/myparcel/notifications"
98
+ }
99
+ client.webhooks.create subscriptions: [webhook]
100
+ ```
101
+
102
+ Getting webhook subscriptions (at least one subscription ID is required):
103
+
104
+ ```ruby
105
+ client.webhooks.find subscription_ids: [1, 2, 3]
106
+ ```
28
107
 
29
108
  ## Development
30
109
 
@@ -3,7 +3,9 @@ module Myparcel
3
3
  # Class for getting delivery options
4
4
  class DeliveryOptions < Myparcel::API::Base
5
5
  def find(options = {})
6
- response = request :get, 'delivery_options', options
6
+ request_options = {}
7
+ request_options[:query] = options
8
+ response = request :get, 'delivery_options', request_options
7
9
  response['data']['delivery']
8
10
  end
9
11
  end
@@ -2,6 +2,10 @@ module Myparcel
2
2
  module API
3
3
  # Class for getting shipments
4
4
  class Shipments < Myparcel::API::Base
5
+ def all
6
+ find
7
+ end
8
+
5
9
  def find(options = {})
6
10
  shipment_ids = options.fetch(:shipment_ids, [])
7
11
  shipment_ids = shipment_ids.join(';') if shipment_ids.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module Myparcel
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myparcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Malykh
@@ -14,140 +14,140 @@ dependencies:
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.14.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: virtus
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.12'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.24'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.24'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: vcr
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '3.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0.10'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.10'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: timecop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.8'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.8'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: dotenv
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '2.1'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '2.1'
153
153
  description: Ruby wrapper for MyParcel API.
@@ -157,12 +157,12 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - .env.example
161
- - .gitignore
162
- - .rspec
163
- - .rubocop.yml
164
- - .rubocop_todo.yml
165
- - .travis.yml
160
+ - ".env.example"
161
+ - ".gitignore"
162
+ - ".rspec"
163
+ - ".rubocop.yml"
164
+ - ".rubocop_todo.yml"
165
+ - ".travis.yml"
166
166
  - CODE_OF_CONDUCT.md
167
167
  - Gemfile
168
168
  - Guardfile
@@ -191,17 +191,17 @@ require_paths:
191
191
  - lib
192
192
  required_ruby_version: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - ! '>='
194
+ - - ">="
195
195
  - !ruby/object:Gem::Version
196
196
  version: '0'
197
197
  required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ! '>='
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 2.6.7
204
+ rubygems_version: 2.5.1
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: MyParcel API Ruby wrapper.