Sha256: 5e4c999b561bc15b7a47a989e9232eeff6a1cc6009ac91fdca5674acb1281ca9

Contents?: true

Size: 738 Bytes

Versions: 7

Compression:

Stored size: 738 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

7 entries across 7 versions & 4 rubygems

Version Path
sproutbox-mousetrap-0.6.4 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.6.2 lib/mousetrap/plan.rb
cameroncox-mousetrap-0.6.1 lib/mousetrap/plan.rb
ryanwood-mousetrap-0.5.7 lib/mousetrap/plan.rb
ryanwood-mousetrap-0.5.6 lib/mousetrap/plan.rb
madebyrocket-mousetrap-0.5.3.8 lib/mousetrap/plan.rb
madebyrocket-mousetrap-0.5.3.7 lib/mousetrap/plan.rb