Module: AusPostAPI::Endpoint::Attributes

Included in:
AusPostAPI::Endpoint
Defined in:
lib/aus_post_api/endpoint/attributes.rb

Overview

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.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
21
# File 'lib/aus_post_api/endpoint/attributes.rb', line 18

def self.included(base)
  base.extend(ClassMethods)
  base.include(InstanceMethods)
end