Sha256: 45a8c663e7b71ef46a6e47ca9dc23d716624ffc90e09dfb5a088f7d093845bbf

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

module Mousetrap
  class Plan < Resource
    attr_accessor \
      :code,
      :name,
      :items,
      :recurring_charge_amount

    def self.all
      response = get_resources plural_resource_name
      return [] unless response['plans']
      build_resources_from response
    end

    protected

    def self.plural_resource_name
      'plans'
    end

    def self.singular_resource_name
      'plan'
    end

    def self.attributes_from_api(attributes)
      {
        :code => attributes['code'],
        :name => attributes['name'],
        :items => attributes['items'],
        :recurring_charge_amount  => attributes['recurringChargeAmount']
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cameroncox-mousetrap-0.5.3.3 lib/mousetrap/plan.rb