Class: Kickscraper::Project

Inherits:
Api
  • Object
show all
Defined in:
lib/kickscraper/client/project.rb

Instance Attribute Summary collapse

Attributes inherited from Api

#raw

Instance Method Summary collapse

Methods inherited from Api

coerce, do_coercion, #initialize, #method_missing, #uid

Constructor Details

This class inherits a constructor from Kickscraper::Api

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Kickscraper::Api

Instance Attribute Details

#commentsObject

Returns the value of attribute comments.



9
10
11
# File 'lib/kickscraper/client/project.rb', line 9

def comments
  @comments
end

#rewardsObject

Returns the value of attribute rewards.



9
10
11
# File 'lib/kickscraper/client/project.rb', line 9

def rewards
  @rewards
end

#updatesObject

Returns the value of attribute updates.



9
10
11
# File 'lib/kickscraper/client/project.rb', line 9

def updates
  @updates
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/kickscraper/client/project.rb', line 34

def active?
    state == "live"
end

#inspectObject



15
16
17
# File 'lib/kickscraper/client/project.rb', line 15

def inspect
    "<Project: '#{to_s}'>"
end

#reload!Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/kickscraper/client/project.rb', line 19

def reload!
    if self.urls.api.nil?
      the_full_project = Kickscraper.client.find_project(self.id)
      project_api_url = the_full_project.nil? ? nil : the_full_project.urls.api.project
    else
      project_api_url = self.urls.api.project
    end
    @raw = Kickscraper.client.process_api_url("Project", project_api_url, false) unless project_api_url.nil?
    Kickscraper::Project::do_coercion(self)
end

#successful?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/kickscraper/client/project.rb', line 30

def successful?
    pledged >= goal
end

#to_sObject



11
12
13
# File 'lib/kickscraper/client/project.rb', line 11

def to_s
    name
end