Class: MageHand::Campaign
- Inherits:
-
Base
- Object
- Base
- MageHand::Campaign
show all
- Defined in:
- lib/ob_port/campaign.rb
Constant Summary
collapse
- ROLES =
{'game_master' => 'Game Master', 'player' => 'Player'}
Instance Attribute Summary
Attributes inherited from Base
#client
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
attr_array, attr_instance, attr_simple, attributes, #attributes, #inflate, inflate_if_nil, #initialize, instance_attributes, #instance_attributes, model_name, #simple_attributes, simple_attributes, #to_json, #update_attributes!
Constructor Details
This class inherits a constructor from MageHand::Base
Class Method Details
.find(id) ⇒ Object
28
29
30
31
|
# File 'lib/ob_port/campaign.rb', line 28
def self.find(id)
hash = JSON.parse(client.access_token.get("/v1/campaigns/#{id}.json").body)
Campaign.new(hash)
end
|
.find_by_slug(slug) ⇒ Object
23
24
25
26
|
# File 'lib/ob_port/campaign.rb', line 23
def self.find_by_slug(slug)
hash = JSON.parse(client.access_token.get("/v1/campaigns/#{slug}.json?use_slug=true").body)
Campaign.new(hash)
end
|
Instance Method Details
#looking_for_players? ⇒ Boolean
33
34
35
|
# File 'lib/ob_port/campaign.rb', line 33
def looking_for_players?
looking_for_players
end
|
#posts ⇒ Object
45
46
47
|
# File 'lib/ob_port/campaign.rb', line 45
def posts
@adventure_logs ||= wiki_pages.select{|page| page.is_post?}
end
|
#role_as_title_string ⇒ Object
37
38
39
|
# File 'lib/ob_port/campaign.rb', line 37
def role_as_title_string
ROLES[self.role]
end
|