Sha256: a6894d16e3df6b1f1b29dec26d5ec5428707c0d24960913279171e6f1313f7da

Contents?: true

Size: 883 Bytes

Versions: 7

Compression:

Stored size: 883 Bytes

Contents

module Hubspot
  class Subscription
    SUBSCRIPTIONS_PATH = '/email/public/v1/subscriptions'
    TIMELINE_PATH      = '/email/public/v1/subscriptions/timeline'
    SUBSCRIPTION_PATH  = '/email/public/v1/subscriptions/:email_address'

    attr_reader :subscribed
    attr_reader :marked_as_spam
    attr_reader :bounced
    attr_reader :status
    attr_reader :subscription_statuses

    def initialize(response_hash)
      @subscribed     = response_hash['subscribed']
      @marked_as_spam = response_hash['markedAsSpam']
      @bounced        = response_hash['bounced']
      @status         = response_hash['status']
      @subscription_statuses  = response_hash['SubscriptionStatuses']
    end

    class << self
      def status(email)
        response = Hubspot::Connection.get_json(SUBSCRIPTION_PATH, {email_address: email})
        new(response)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hubspot-ruby-0.9.0 lib/hubspot/subscription.rb
hubspot-ruby-0.8.1 lib/hubspot/subscription.rb
hubspot-ruby-0.8.0 lib/hubspot/subscription.rb
hubspot-ruby-0.7.0 lib/hubspot/subscription.rb
hubspot-ruby-0.6.1 lib/hubspot/subscription.rb
hubspot-ruby-0.6.0 lib/hubspot/subscription.rb
hubspot-ruby-0.5.0 lib/hubspot/subscription.rb