Class: RecordMedium::Import
- Inherits:
-
Object
- Object
- RecordMedium::Import
- Defined in:
- lib/record_medium/import.rb
Overview
Import methods
Constant Summary collapse
- HOST =
'https://recordmedium.com'
- API =
'v1'
Instance Method Summary collapse
- #add(data) ⇒ Object
- #data_params(data) ⇒ Object
-
#initialize(key) ⇒ Import
constructor
A new instance of Import.
- #set(data) ⇒ Object
Constructor Details
#initialize(key) ⇒ Import
Returns a new instance of Import.
9 10 11 12 |
# File 'lib/record_medium/import.rb', line 9 def initialize(key) @key = key raise ArgumentError, 'No key' unless @key end |
Instance Method Details
#add(data) ⇒ Object
14 15 16 |
# File 'lib/record_medium/import.rb', line 14 def add(data) HTTParty.post("#{HOST}/api/#{API}/records/#{@key}/add", data_params(data)) end |
#data_params(data) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/record_medium/import.rb', line 22 def data_params(data) { body: { data: data.to_json } } end |