Class: PayPal::SDK::REST::DataTypes::Template
- Inherits:
-
Base
- Object
- Core::API::DataTypes::Base
- Base
- PayPal::SDK::REST::DataTypes::Template
- Includes:
- RequestDataType
- Defined in:
- lib/paypal-sdk/rest/data_types.rb
Constant Summary
Constants inherited from Core::API::DataTypes::Base
Core::API::DataTypes::Base::ContentKey, Core::API::DataTypes::Base::HashOptions
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods included from RequestDataType
Methods included from SetAPI
#client_id=, #client_secret=, #set_config, #token=
Methods inherited from Base
#http_header, #merge!, #raise_error!, raise_on_api_error, #success?
Methods inherited from Core::API::DataTypes::Base
add_attribute, add_member, array_of, #convert_array, #convert_object, define_alias_methods, #hash_key, #initialize, #member_names, members, #members, #merge!, object_of, #set, #skip_value?, snakecase, #to_hash, #value_to_hash
Methods included from Core::Logging
#log_event, #logger, logger, logger=
Constructor Details
This class inherits a constructor from PayPal::SDK::Core::API::DataTypes::Base
Class Method Details
.get(template_id, options = {}) ⇒ Object
1372 1373 1374 1375 1376 |
# File 'lib/paypal-sdk/rest/data_types.rb', line 1372 def get(template_id, = {}) raise ArgumentError.new("template_id required") if template_id.to_s.strip.empty? path = "v1/invoicing/templates/#{template_id}" self.new(api.get(path, )) end |
.load_members ⇒ Object
1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 |
# File 'lib/paypal-sdk/rest/data_types.rb', line 1337 def self.load_members object_of :template_id, String object_of :name, String object_of :default, Boolean object_of :template_data, TemplateData array_of :settings, TemplateSettings object_of :unit_of_measure, String object_of :custom, Boolean array_of :links, Links end |
Instance Method Details
#create ⇒ Object
1364 1365 1366 1367 1368 1369 |
# File 'lib/paypal-sdk/rest/data_types.rb', line 1364 def create() path = "v1/invoicing/templates" response = api.post(path, self.to_hash, http_header) self.merge!(response) Template.new(response) end |
#delete ⇒ Object
1350 1351 1352 1353 1354 1355 |
# File 'lib/paypal-sdk/rest/data_types.rb', line 1350 def delete() path = "v1/invoicing/templates/#{self.template_id}" response = api.delete(path, {}) self.merge!(response) success? end |