Class: Railsonfire::User

Inherits:
Object
  • Object
show all
Defined in:
lib/railsonfire/railsonfire.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(railsonfire_token, github_token) ⇒ User

Returns a new instance of User.



86
87
88
89
# File 'lib/railsonfire/railsonfire.rb', line 86

def initialize railsonfire_token, github_token
  @railsonfire_token = railsonfire_token
  @github_token = github_token
end

Instance Attribute Details

#github_tokenObject (readonly)

Returns the value of attribute github_token.



85
86
87
# File 'lib/railsonfire/railsonfire.rb', line 85

def github_token
  @github_token
end

#railsonfire_tokenObject (readonly)

Returns the value of attribute railsonfire_token.



85
86
87
# File 'lib/railsonfire/railsonfire.rb', line 85

def railsonfire_token
  @railsonfire_token
end

Instance Method Details

#configObject



91
92
93
# File 'lib/railsonfire/railsonfire.rb', line 91

def config
  JSON.parse(HTTParty.get(Railsonfire::DOMAIN + "/projects/#{Railsonfire.config["id"]}/get_config?railsonfire_token=#{@railsonfire_token}").body)
end

#remove_config(key) ⇒ Object



99
100
101
# File 'lib/railsonfire/railsonfire.rb', line 99

def remove_config key
  HTTParty.delete(Railsonfire::DOMAIN + "/projects/#{Railsonfire.config["id"]}/remove_config?railsonfire_token=#{@railsonfire_token}&key=#{key}")
end

#set_config(key, value) ⇒ Object



95
96
97
# File 'lib/railsonfire/railsonfire.rb', line 95

def set_config key, value
  HTTParty.post(Railsonfire::DOMAIN + "/projects/#{Railsonfire.config["id"]}/add_config?railsonfire_token=#{@railsonfire_token}", :headers => {"Content-Type" => "application/json"}, :body => {"config" => {key => value}}.to_json)
end