oshpark 0.0.10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +192 -39
- data/lib/oshpark/client.rb +5 -5
- data/lib/oshpark/connection.rb +12 -6
- data/lib/oshpark/model.rb +1 -0
- data/lib/oshpark/order.rb +9 -15
- data/lib/oshpark/project.rb +2 -3
- data/lib/oshpark/shipping_rate.rb +5 -0
- data/lib/oshpark/version.rb +1 -1
- data/oshpark.gemspec +1 -1
- data/spec/acceptance/workflow_spec.rb +3 -4
- data/spec/fixtures/cassettes/RSpec_ExampleGroups_APIWorkflow.yml +15547 -1451
- data/spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAPassword_WithAValidPassword_Token_2.yml +128 -0
- data/spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAPassword_WithAnInvalidPassword.yml +121 -0
- data/spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAnAPISecret_WithAValidAPISecret_Token_2.yml +129 -0
- data/spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAnAPISecret_WithAnInvalidAPISecret.yml +122 -0
- data/spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Token.yml +64 -0
- data/spec/lib/oshpark/client_spec.rb +2 -3
- data/spec/lib/oshpark/import_spec.rb +1 -0
- data/spec/lib/oshpark/order_spec.rb +4 -4
- data/spec/lib/oshpark/panel_spec.rb +1 -0
- data/spec/lib/oshpark/project_spec.rb +1 -0
- data/spec/lib/oshpark/upload_spec.rb +1 -0
- metadata +13 -3
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://oshpark.com/api/v1/sessions
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
base64_string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 201
|
19
|
+
message: Created
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Cowboy
|
23
|
+
Date:
|
24
|
+
- Tue, 06 Jan 2015 03:31:10 GMT
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Strict-Transport-Security:
|
28
|
+
- max-age=31536000
|
29
|
+
X-Frame-Options:
|
30
|
+
- SAMEORIGIN
|
31
|
+
X-Xss-Protection:
|
32
|
+
- 1; mode=block
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
Location:
|
36
|
+
- "/api/v1/sessions.%23%3CApiSessionToken:0x007fa0880ff2f0%3E"
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Etag:
|
40
|
+
- '"1ae6478c1175923e962f9ab6d570b899"'
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, private, must-revalidate
|
43
|
+
Set-Cookie:
|
44
|
+
- _Playground_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTM5MTZhN2M5ODU5N2I5ZjYwYjlmZThiYjQ1ZWNjMDg0BjsAVEkiEXByZXZpb3VzX3VybAY7AEZJIhUvYXBpL3YxL3Nlc3Npb25zBjsAVA%3D%3D--1e995382af741eec96efa2dbd73eaa3eeab8c9d4;
|
45
|
+
path=/; secure; HttpOnly
|
46
|
+
X-Request-Id:
|
47
|
+
- 123249c8-29ff-4b91-9615-926cb0204e21
|
48
|
+
X-Runtime:
|
49
|
+
- '0.026389'
|
50
|
+
Transfer-Encoding:
|
51
|
+
- chunked
|
52
|
+
Via:
|
53
|
+
- 1.1 vegur
|
54
|
+
body:
|
55
|
+
encoding: UTF-8
|
56
|
+
base64_string: |
|
57
|
+
eyJhcGlfc2Vzc2lvbl90b2tlbiI6eyJ0b2tlbiI6Ilh4Q3JMQkU5M0kzVXVB
|
58
|
+
WWxqYTRScUVZcjVhTW9EWWRqNVJqUzRPdDNnSElzU3hsRFBoeWszWDhVVjBi
|
59
|
+
RTRTTnBpT0t5enhoTVJ4N21aT1BCNDRjM0RuMTNwVm5LMGY1azNKWTNFRm03
|
60
|
+
UUUwSlRjbTBERGQxM1ByYXJEUGV3bU9wIiwidHRsIjoxMTk5LCJ1c2VyX2lk
|
61
|
+
IjpudWxsfX0=
|
62
|
+
http_version:
|
63
|
+
recorded_at: Tue, 06 Jan 2015 03:31:10 GMT
|
64
|
+
recorded_with: VCR 2.9.3
|
@@ -117,10 +117,9 @@ describe Oshpark::Client do
|
|
117
117
|
|
118
118
|
describe '#set_order_shipping_rate' do
|
119
119
|
let(:token) { 'abcd1234' }
|
120
|
-
let(:
|
121
|
-
let(:service_name) { 'Overnight Delivery' }
|
120
|
+
let(:shipping_rate) { {carrier_name: "Bobs Mail", service_name: "Overnight Delivery"} }
|
122
121
|
it "sets the shipping rate for an order" do
|
123
|
-
subject.set_order_shipping_rate token,
|
122
|
+
subject.set_order_shipping_rate token, shipping_rate
|
124
123
|
expect(connection.requests.last).to eq([:post, "orders/#{token}/set_shipping_rate", {order: {shipping_rate: {carrier_name: "Bobs Mail", service_name: "Overnight Delivery"}}}])
|
125
124
|
end
|
126
125
|
end
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Oshpark::Import do
|
4
4
|
subject { Oshpark::Import.new({}) }
|
5
5
|
it { should be_an Oshpark::Model }
|
6
|
+
it { should be_an Oshpark::RemoteModel }
|
6
7
|
|
7
8
|
%w| id state original_url original_filename error_message queued_at started_at completed_at errored_at failed_at project_id |.each do |attr|
|
8
9
|
it { should respond_to attr }
|
@@ -7,6 +7,7 @@ describe Oshpark::Order do
|
|
7
7
|
|
8
8
|
subject { Oshpark::Order.new({}) }
|
9
9
|
it { should be_an Oshpark::Model }
|
10
|
+
it { should be_an Oshpark::RemoteModel }
|
10
11
|
|
11
12
|
%w| id board_cost cancellation_reason cancelled_at ordered_at payment_provider payment_received_at project_name quantity shipping_address shipping_cost shipping_country shipping_method shipping_name state total_cost project_id panel_id |.each do |attr|
|
12
13
|
it { should respond_to attr }
|
@@ -65,13 +66,12 @@ describe Oshpark::Order do
|
|
65
66
|
end
|
66
67
|
|
67
68
|
describe '#set_shipping_rate' do
|
68
|
-
let(:
|
69
|
-
let(:service_name) { 'Overnight Delivery' }
|
69
|
+
let(:shipping_rate) { Oshpark::ShippingRate.new carrier_name: 'Bobs Mail', service_name: 'Overnight Delivery' }
|
70
70
|
it 'sets the shipping rate for an Order' do
|
71
71
|
allow(subject).to receive(:id).and_return('abcd1234')
|
72
72
|
|
73
|
-
expect(Oshpark::client).to receive(:set_order_shipping_rate).with("abcd1234",
|
74
|
-
subject.set_shipping_rate
|
73
|
+
expect(Oshpark::client).to receive(:set_order_shipping_rate).with("abcd1234", shipping_rate).and_return({'order' => {id: "abcd1234"}})
|
74
|
+
subject.set_shipping_rate shipping_rate
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Oshpark::Panel do
|
4
4
|
subject { Oshpark::Panel.new({}) }
|
5
5
|
it { should be_an Oshpark::Model }
|
6
|
+
it { should be_an Oshpark::RemoteModel }
|
6
7
|
it { should respond_to :pcb_layers }
|
7
8
|
it { should respond_to :scheduled_order_time }
|
8
9
|
it { should respond_to :expected_receive_time }
|
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Oshpark::Upload do
|
4
4
|
subject { Oshpark::Upload.new({}) }
|
5
5
|
it { should be_an Oshpark::Model }
|
6
|
+
it { should be_an Oshpark::RemoteModel }
|
6
7
|
|
7
8
|
%w| id state original_filename error_message queued_at started_at completed_at errored_at failed_at project_id |.each do |attr|
|
8
9
|
it { should respond_to attr }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oshpark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Harton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -255,6 +255,11 @@ files:
|
|
255
255
|
- spec/fixtures/2-Layer.brd
|
256
256
|
- spec/fixtures/cassettes/RSpec_ExampleGroups_APIWorkflow.yml
|
257
257
|
- spec/fixtures/cassettes/RSpec_ExampleGroups_APIWorkflow_WhenPayingByInvoice.yml
|
258
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAPassword_WithAValidPassword_Token_2.yml
|
259
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAPassword_WithAnInvalidPassword.yml
|
260
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAnAPISecret_WithAValidAPISecret_Token_2.yml
|
261
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAnAPISecret_WithAnInvalidAPISecret.yml
|
262
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Token.yml
|
258
263
|
- spec/lib/oshpark/address_spec.rb
|
259
264
|
- spec/lib/oshpark/client_spec.rb
|
260
265
|
- spec/lib/oshpark/image_spec.rb
|
@@ -271,7 +276,7 @@ files:
|
|
271
276
|
- spec/support/helper.rb
|
272
277
|
- spec/support/http_client.rb
|
273
278
|
- spec/support/vcr.rb
|
274
|
-
homepage:
|
279
|
+
homepage: https://github.com/oshpark/ruby-api-client
|
275
280
|
licenses:
|
276
281
|
- MIT
|
277
282
|
metadata: {}
|
@@ -301,6 +306,11 @@ test_files:
|
|
301
306
|
- spec/fixtures/2-Layer.brd
|
302
307
|
- spec/fixtures/cassettes/RSpec_ExampleGroups_APIWorkflow.yml
|
303
308
|
- spec/fixtures/cassettes/RSpec_ExampleGroups_APIWorkflow_WhenPayingByInvoice.yml
|
309
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAPassword_WithAValidPassword_Token_2.yml
|
310
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAPassword_WithAnInvalidPassword.yml
|
311
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAnAPISecret_WithAValidAPISecret_Token_2.yml
|
312
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Authenicate_WithAnAPISecret_WithAnInvalidAPISecret.yml
|
313
|
+
- spec/fixtures/cassettes/RSpec_ExampleGroups_OshparkClient_Token.yml
|
304
314
|
- spec/lib/oshpark/address_spec.rb
|
305
315
|
- spec/lib/oshpark/client_spec.rb
|
306
316
|
- spec/lib/oshpark/image_spec.rb
|