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.



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

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.



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

def artist
  @artist
end

#trackObject (readonly)

Returns the value of attribute track.



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

def track
  @track
end

Instance Method Details

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



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

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

#share!Object



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

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