lib/eatabit_rails/account.rb in eatabit_rails-0.2.0 vs lib/eatabit_rails/account.rb in eatabit_rails-0.2.1

- old
+ new

@@ -1,24 +1,27 @@ +# frozen_string_literal: true + module EatabitRails class Account + attr_reader( + :name, + :environment, + :enabled, + :created_at + ) - attr_reader :name, - :environment, - :enabled, - :created_at - def initialize(attributes) - @name = attributes['name'] - @environment = attributes['environment'] - @enabled = attributes['enabled'] - @created_at = attributes['created_at'] + @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'] + params = EatabitRails::REST::Uri.default_params + response = RestClient.get(account_uri, params) + attributes = JSON.parse(response.body)['account'] new(attributes) end end end