easypost 2.1.10 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd5cf919f93399db7eb981bdf495b560410b9173
4
- data.tar.gz: 64da74374aa96f9f0919538476b33d15e4d06440
3
+ metadata.gz: 4a3a13e746d0851d4cb46f56364bb3f769886cc5
4
+ data.tar.gz: fa679d039ad77f52bb824ef8c46fc437edb05b6d
5
5
  SHA512:
6
- metadata.gz: c01785be20060a94f0c6da1d69148784a8bb9ddc687b3dc67ae339759bb3eb51c1fc8cadf630c82fc5fc7741663e2fecc03b204e484728f2cf01dd9211349496
7
- data.tar.gz: 9f9b22fd4be1a89dad04a988ebcfc11672a32f0b63918eb30c40dabbcacc169db1e5e420e9abf50cd10fdc04644e207c93d2262db72f2ba298e005db149ad684
6
+ metadata.gz: 7d4a210542383e8c9c38b9a9bdb26d63d5c2c3b9716be4d2d59f92dd183c0a7abf56e9acf82027e353b1ad3d0fa3a0c222b9121cfd6fcc154df1c704b26b8508
7
+ data.tar.gz: c5577db5003a094d9489a15b314f49b878478cb031ddfc2fa93b1870cdc024a6e47a265a26ca954af353d72db9577cd0d2ad146575f902fcd07fead5c337c479
data/CHANGELOG CHANGED
@@ -1,7 +1,12 @@
1
+ === 2.1.11 2016-02-04
2
+
3
+ * Allowed user creation for top-level users
4
+
5
+
1
6
  === 2.1.10 2015-12-23
2
7
 
3
8
  * Added verify and verify_strict params to Address.create
4
- * Added Tracker.create_list and Tracker.all_updated for working with large
9
+ * Added Tracker.create_list and Tracker.all_updated for working with large
5
10
  numbers of Trackers.
6
11
 
7
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.10
1
+ 2.1.11
data/lib/easypost.rb CHANGED
@@ -81,9 +81,11 @@ module EasyPost
81
81
  self.http_config.merge!(http_config_params)
82
82
  end
83
83
 
84
- def self.request(method, url, api_key, params={}, headers={})
84
+ def self.request(method, url, api_key, params={}, headers={}, api_key_required=true)
85
85
  api_key ||= @@api_key
86
- raise Error.new('No API key provided.') unless api_key
86
+ if api_key_required
87
+ raise Error.new('No API key provided.') unless api_key
88
+ end
87
89
 
88
90
  params = Util.objects_to_ids(params)
89
91
  url = self.api_url(url)
data/lib/easypost/user.rb CHANGED
@@ -1,5 +1,12 @@
1
1
  module EasyPost
2
2
  class User < Resource
3
+ def self.create(params={}, api_key=nil)
4
+ wrapped_params = {}
5
+ wrapped_params[self.class_name().to_sym] = params
6
+ response, api_key = EasyPost.request(:post, self.url, api_key, wrapped_params, {}, false)
7
+ return Util.convert_to_easypost_object(response, api_key)
8
+ end
9
+
3
10
  def save
4
11
  if @unsaved_values.length > 0
5
12
  values = {}
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,5 @@ Dir["./spec/support/**/*.rb"].each { |f| require f }
6
6
  RSpec.configure do |config|
7
7
  config.before(:each) do
8
8
  EasyPost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
9
- EasyPost.api_base = 'http://easypost-vm:5000/v2/'
10
9
  end
11
10
  end
data/spec/user_spec.rb CHANGED
@@ -5,6 +5,22 @@ describe EasyPost::User do
5
5
  EasyPost.api_key = "PRODUCTION API KEY"
6
6
  end
7
7
 
8
+ # This test requires APIKEY to be nil
9
+ # it 'creates a new user' do
10
+ # EasyPost.api_key = nil
11
+
12
+ # user = EasyPost::User.create({
13
+ # name: "Chad Vader",
14
+ # email: 'c.vader3@example.com',
15
+ # password: "4theempire",
16
+ # password_confirmation: "4theempire",
17
+ # phone_number: '555-123-4321'
18
+ # })
19
+
20
+ # expect(user.id).not_to be_nil
21
+ # end
22
+
23
+
8
24
  # Uncomment these tests to test CRUD operations on the User model
9
25
  # Note: You must provide a Production Api Key in order to run these tests
10
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easypost
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.10
4
+ version: 2.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sawyer Bateman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client