module AusPostAPI::Endpoint::Attributes

The attributes module adds a class level DSL that allows required and optional attributes to be set using the same interface as ‘attr_accessor`

eg.

class Example
  include Attributes

  required_attributes :one, :two
  optional_attributes :three
end

Additionally it adds two instance methods: ‘required_attributes` & `optional_attributes` that return an array of attributes specified by the two methods.

Public Class Methods

included(base) click to toggle source
# File lib/aus_post_api/endpoint/attributes.rb, line 18
def self.included(base)
  base.extend(ClassMethods)
  base.include(InstanceMethods)
end