rafter-fulfillment 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,75 @@
1
+ require 'rafter-fulfillment'
2
+ require 'faker'
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # Require this file using `require "spec_helper"` to ensure that it is only
7
+ # loaded once.
8
+ #
9
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
21
+
22
+ def mock_client_ref_id(prepend)
23
+ "#{prepend}_#{SecureRandom.uuid}"
24
+ end
25
+
26
+ def mock_order_client_ref_id
27
+ mock_client_ref_id("FAKE_ORDER")
28
+ end
29
+
30
+ def mock_ship_client_ref_id
31
+ mock_client_ref_id("FAKE_SHIP")
32
+ end
33
+
34
+ def mock_order_data(client_ref_id)
35
+ {
36
+ "ship_date" => "#{future_date}",
37
+ "fulfillment_shipping_address" => {
38
+ "name" => Faker::Company.name,
39
+ "street_address_1" => Faker::Address.street_address,
40
+ "street_address_2" => Faker::Address.secondary_address,
41
+ "city" => Faker::Address.city,
42
+ "state" => Faker::Address.state_abbr,
43
+ "postal_code" => Faker::Address.zip_code,
44
+ "country" => "USA"
45
+ },
46
+ "client_reference_id" => "#{client_ref_id}",
47
+ "fulfillment_provider" => "Ingram",
48
+ "fulfillment_order_items" => []
49
+ }
50
+ end
51
+
52
+ def mock_shipment_data(order_item_public_ids_array)
53
+ {
54
+ "tracking_number" => "1Z1234567",
55
+ "carrier" => "UPS",
56
+ "carrier_code" =>"Second Day",
57
+ "shipment_reference_id" =>"#{mock_ship_client_ref_id}",
58
+ "fulfillment_order_items" => mock_shipment_item_data(order_item_public_ids_array)
59
+ }
60
+ end
61
+
62
+ def mock_shipment_item_data(order_item_public_ids_array)
63
+ order_item_public_ids_array.collect { |public_id| {"public_id" => public_id } }
64
+ end
65
+
66
+ def future_date
67
+ now = Time.now
68
+ Date.new(now.year + 1, now.month, now.day)
69
+ end
70
+
71
+ def mock_order_item_data(n=2)
72
+ data = []
73
+ n.times { data << { "fulfillable_type" => "BookInstance", "fulfillable_id" => rand(1..100000) } }
74
+ data
75
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rafter-fulfillment
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Michael Pearce
8
+ - Paolo Resmini
9
+ - Dudley Chamberlin
10
+ - Peter Myers
11
+ - Nick Zalabak
12
+ - Mike 'sealabcore' Taylor
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2014-04-18 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: bundler
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: '1.5'
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '1.5'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rake
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: 2.11.0
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: 2.11.0
60
+ - !ruby/object:Gem::Dependency
61
+ name: pry
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: faker
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ - !ruby/object:Gem::Dependency
89
+ name: curb
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ type: :runtime
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: json
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ type: :runtime
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: activesupport
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ type: :runtime
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ description:
131
+ email:
132
+ - exchange-engineers@rafter.com
133
+ executables: []
134
+ extensions: []
135
+ extra_rdoc_files: []
136
+ files:
137
+ - .gitignore
138
+ - .rspec
139
+ - .ruby-gemset
140
+ - .ruby-version
141
+ - Gemfile
142
+ - LICENSE.txt
143
+ - README.md
144
+ - Rakefile
145
+ - lib/fulfillment/client.rb
146
+ - lib/fulfillment/client_exception.rb
147
+ - lib/fulfillment/creation_exception.rb
148
+ - lib/fulfillment/model_base.rb
149
+ - lib/fulfillment/order.rb
150
+ - lib/fulfillment/order_item.rb
151
+ - lib/fulfillment/paged_result.rb
152
+ - lib/fulfillment/paging_envelope.rb
153
+ - lib/fulfillment/search_exception.rb
154
+ - lib/fulfillment/shipment.rb
155
+ - lib/fulfillment/shipment_item.rb
156
+ - lib/fulfillment/version.rb
157
+ - lib/rafter-fulfillment.rb
158
+ - rafter-fulfillment.gemspec
159
+ - spec/client_spec.rb
160
+ - spec/order_item_spec.rb
161
+ - spec/order_spec.rb
162
+ - spec/shipment_spec.rb
163
+ - spec/spec_helper.rb
164
+ homepage: https://github.com/bkr/rafter-fulfillment
165
+ licenses:
166
+ - Apache 2.0
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubyforge_project:
184
+ rubygems_version: 2.1.11
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: Client for the Rafter Fulfillment API
188
+ test_files:
189
+ - spec/client_spec.rb
190
+ - spec/order_item_spec.rb
191
+ - spec/order_spec.rb
192
+ - spec/shipment_spec.rb
193
+ - spec/spec_helper.rb