Class: Mounce

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file = '~/.mounce.yml') ⇒ Mounce

Returns a new instance of Mounce.



7
8
9
10
11
# File 'lib/mounce.rb', line 7

def initialize(config_file='~/.mounce.yml')
  config(File.expand_path(config_file))
  @itunes = OSA.app('iTunes')
  @artist, @track = find_song_information
end

Instance Attribute Details

#artistObject (readonly)

Returns the value of attribute artist.



5
6
7
# File 'lib/mounce.rb', line 5

def artist
  @artist
end

#trackObject (readonly)

Returns the value of attribute track.



5
6
7
# File 'lib/mounce.rb', line 5

def track
  @track
end

Instance Method Details

#message(tag = '#music') ⇒ Object



13
14
15
16
# File 'lib/mounce.rb', line 13

def message(tag='#music')
  text = [@artist, @track].compact.join(' - ')
  "#{tag} #{text}"
end

#share!Object



18
19
20
# File 'lib/mounce.rb', line 18

def share!
  `curl #{@config['api']} -u #{@config['username']}:#{@config['password']} -d status="#{message}" -d source="mounce"`
end