Sha256: bcc70713db53f631df7e31305c4e10d7505485236479653b285137655ccdbc00

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module EatabitRails
  class Account
    attr_reader(
      :name,
      :environment,
      :enabled,
      :created_at
    )

    def initialize(attributes)
      @name = attributes['name']
      @environment = attributes['environment']
      @enabled = attributes['enabled']
      @created_at = attributes['created_at']
    end

    def self.find
      account_uri = EatabitRails::REST::Uri.new.account
      params = EatabitRails::REST::Uri.default_params
      response = RestClient.get(account_uri, params)
      attributes = JSON.parse(response.body)['account']

      new(attributes)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eatabit_rails-0.2.1 lib/eatabit_rails/account.rb