Sha256: da6d4a5eb5bc5350300abe65ebf4addb2b7f89c2a894288818c87a59ab2a51fc
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
class EasyPost::User < EasyPost::Resource def self.create(params={}, api_key=nil) response = EasyPost.make_request(:post, self.url, api_key, {self.class_name.to_sym => params}) return EasyPost::Util.convert_to_easypost_object(response, api_key) end def save if @unsaved_values.length > 0 values = {} @unsaved_values.each { |k| values[k] = @values[k] } wrapped_params = {user: values} response = EasyPost.make_request(:put, url, @api_key, wrapped_params) refresh_from(response, api_key) end return self end def self.retrieve_me self.all end def self.all_api_keys response = EasyPost.make_request(:get, "/api_keys", @api_key) return EasyPost::Util.convert_to_easypost_object(response, api_key) end def api_keys api_keys = EasyPost::User.all_api_keys if api_keys.id == self.id my_api_keys = api_keys.keys else for child in api_keys.children if child.id == self.id my_api_keys = child.keys break end end end my_api_keys end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
easypost-3.3.0 | lib/easypost/user.rb |
easypost-3.2.0 | lib/easypost/user.rb |
easypost-3.1.5 | lib/easypost/user.rb |